Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Coloring


ghost's Avatar
0 0

I am having trouble getting the color thing down for c++. I am trying to edit a program that I found included in a tutorial. So if anyone can help me color the text/background it would be much appreiciated.

#include<iostream> using namespace std; int cube(int the_number) { int result = the_number * the_number * the_number; return result; } int main(){ int number; cout<< "This is my first C++ program. I hope you find it interesting" <<endl; cout << "Please enter a number to find the cube of: " <<endl; cin >> number; int answer = cube(number); cout << "The square of the number you entered is " << answer << endl; system("pause"); return 0; }


mido's Avatar
Member
0 0

If youre using Borland or Turbo C++, you can use the "textcolor()" and "textbackground()" functions, if you want to use system(), you can just add "system("color x"); where x can be 0-7/a-f


ghost's Avatar
0 0

No clue what you are talking about dude. I use Dev-C++.


mido's Avatar
Member
0 0

:vamp:Ok use system("color 1"); for example