Setting a text color gloabally

I wanted to know if there is a way to set a textcolor globally, like for all console output for a program, i'd like to have the same color. I tried just using textcolor(); in my main function but it seems like it is changing color to the default one halfway between cout statements in other fucntions.
Thank you.
1
2
3
4
5
6
7
8
9
10
#include <iostream>
using namespace std;

int main(){
	
	system("color XY"); 
	cout << "Hello World!";

return 0;		
}


here,
X = background color (0 to 9 , A to F)
Y = text color (0 to 9 , A to F)
that statement doesn't seem to work on turboc++
right now, the problem is that when I use textcolor, it does work, but halfway through the output, the color reverts back to default.

Here's my output code.
Right after where it says about, the color changes back.

1
2
3
4
5
6
7
   char a[]="                                MAIN MENU \n\n1.Administrator mode\n2.Consumer Mode\n3.
More Information\n4.About\n5.Exit             Please enter a valid choice to continue.\n";
for (int i=0;a[i]!='\0';i++)
    {
     cout<<a[i];
      delay(10);
     }

Topic archived. No new replies allowed.