trouble with simple program

I need help with the code.

#include <iostream>
using namespace std;

int main()
{

char letter = 's';
int number = 1000000;
float number2 = 6.9;
double number3 = 1.73;
bool ? = true;

cout << "The letter is " << letter << endl;
cout << "number is " << number << endl;
cout << "number 2 is " << number2 << endl;
cout << "number 3 is " << number3 << endl;
cout << "the source is " << ? << endl;
return 0;

}


I compiled it and tried to run it and it doesnt seem to work. Please Help me .


P.S I am a NooB
? is not a valid variable name. this code should not even compile.
Oh and can someone give me a brief description on how to write variables please?
What should i replace ? with?
You have a bunch of correct variable names there (letter, number, number2, number3). Can you figure it out?
sorry, i am trying to learn from a book i got but its not very good at explaining things. :(
Nope i dont understand whats wrong.
A variable can't contain a '?'. It must start with a letter or an underscore, after the first letter any letter, number and underscore can come.
examples:
x1
_x2
variable
variable2
Last edited on
Okay thanks for all of your help i change it and it works now

thank you all.
Topic archived. No new replies allowed.