Quick question about a switch statement

After reading the lesson about switch statements I am confused so I set up 2 examples here. In example one if i start it with switch (x) and then have case 1, does that mean if x==1 then it will cout "x is 1" or what? And if not, would my second example work? thanks. And i dont get it what is supposed to be inside switch(inside here). Is it supposed to be the variable or just whatever you want to call the switch??



example 1
switch (x)
case 1:
cout<<"x is 1";

example 2
switch(x):
case (x==1):
cout<<"x is 1";
pls helps
Check out the tutorial section in C++ which talks about switch statements:
http://www.cplusplus.com/doc/tutorial/control/
i did but i just dont understand t hat one thang
help pls
Topic archived. No new replies allowed.