Ok im new to C++ so please help, so I have this line of code.

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
cout << "Congratulations your power level is now" << PowerLevel << endl;

insted of typing this all the time can i just add it to another cpp file and just reference it or something like that ?

Sorry if i titled it wrong buy as i said im new.

Sure. You'd wrap the lines in a function and simply call the function when you need those lines to be executed:

void show_powerlevel()
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
    cout << "Congratulations your power level is now" << PowerLevel << endl;
}

...

// Use it like this:
show_powerlevel();