Whitespace
Mar 23, 2009 at 7:08pm UTC
Could anyone explain why that when I compile this it doesnt form a newline?
Am I missing something that i have? Cause I thought that endl or /n meant newline.
Please and Thank you ^_^
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#include <iostream>
using namespace std;
int main ()
{
cout << "Difficulty Levels/n/n" ;
cout << "1 - Easy/n" ;
cout << "2 - Normal/n" ;
cout << "3 - Hard/n/n" ;
int choice;
cout << "Choice"
cin >> choice;
switch (choice)
{
case 1:
cout << "You picked Easy./n" ;
break ;
case 2:
cout << "You picked Normal./n" ;
case 3:
cout << "You picked hard./n" ;
default
cout << "You made an Illegal choice./n" ;
}
return 0;
}
Mar 23, 2009 at 7:09pm UTC
lol and there are breaks under lines 22 24 and 26. but that doesnt explain why it isnt forming new lines.
Mar 23, 2009 at 8:07pm UTC
\n
will do the trick.
Last edited on Mar 23, 2009 at 8:11pm UTC
Mar 23, 2009 at 8:25pm UTC
Right, But for some reason, It makes it all in the same line, and shows up as something like /n1 - Easy /n2 - Normal etc.
Mar 23, 2009 at 8:42pm UTC
As chungolongo pointed out, \n will work. There is a very big difference between \n and /n.
Mar 24, 2009 at 6:04pm UTC
wow.. I feel extremely stupid.. sorry for wasting time. ^_^
Mar 24, 2009 at 6:38pm UTC
Believe me, it's a mistake that just about everybody has made at some point.
Topic archived. No new replies allowed.