Is there anything that can be done to change C++ text into different colors or fonts and can you change the backround from black to somthing else? thank you in advanced
Printable View
Is there anything that can be done to change C++ text into different colors or fonts and can you change the backround from black to somthing else? thank you in advanced
thank you and I got a problem with this
Im trying to make it read a random number but a get alot of errors. Any suggestions?Code:#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int randmon[1] = 1000;
int randmon[2] = 2000;
int randmon[3] = 3000;
int randmon[4] = 4000;
if (randmon == 1000)
{
cout<<"Hello";
cin.get();
if (randmon == 2000)
{
cout<<"What?";
cin.get();
if (randmon == 3000)
{
cout<<"Maybe?!";
cin.get();
if (randmon == 4000)
{
cout<<"No or yes which one?";
cin.get();
}
}
}
}
}
Code:#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int randmon[5] = {0, 1000, 2000, 3000, 4000};
//I don't get what you're trying to do from this point on
if (randmon == 1000)
{
cout<<"Hello";
cin.get();
if (randmon == 2000)
{
cout<<"What?";
cin.get();
if (randmon == 3000)
{
cout<<"Maybe?!";
cin.get();
if (randmon == 4000)
{
cout<<"No or yes which one?";
cin.get();
}
}
}
}
}
Thank you and to you above umm I was just playing around :D
also thanx dave
thank you, i still don't know how to compile a code on codeblock though... :(
but now I get an error saying
ISO C++ forbids comparrision between pointer and integer
> ISO C++ forbids comparrision between pointer and integer
Good for you.
Wanna post some code to go with that?
the code is up there
You are trying to compare randmon (the starting address of an array) to an integer.
randmon[i] represents an individual element of the array
And you're declaring randmon multiple times. And you can't initialize it like that (it's an array).
Try rand() and srand() (<cstdio>), and time() (<ctime>).Quote:
Im trying to make it read a random number but a get alot of errors.
(Sorry, Prelude.)Code:#include <iostream>
#include <cstdio>
#include <ctime>
int main(void) {
srand(time(0));
std::cout << "A random number between 0 and 9: " << rand() % 10 << std::endl;
return 0;
}