x was not declared in this scope

I declared 'x' but I don't know what' wrong. Please help me, thank you. (Here you have the 'wrong' part.
__________________________________


cout<<"x: ";
cin>>x;
int i=2;
int z=1;
int s=1;
int p=1;
cin>>x;
Here you are trying to put a value in a variable named x. But you never created a variable named x. You have to create variables before you can use them.

Here is an example showing how to create a variable named x. In this example, x is an int.
int x;

Here is another example showing how to create a variable named x. In this example, x is a string.
string x;
You need to show how this relates to the place where you declared x. Maybe post the complete code - or at least show enough to be able to reproduce the problem.
Thank you very much :D
Topic archived. No new replies allowed.