Whitespace


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;
}
lol and there are breaks under lines 22 24 and 26. but that doesnt explain why it isnt forming new lines.
\n will do the trick.

Last edited on
Right, But for some reason, It makes it all in the same line, and shows up as something like /n1 - Easy /n2 - Normal etc.
As chungolongo pointed out, \n will work. There is a very big difference between \n and /n.
wow.. I feel extremely stupid.. sorry for wasting time. ^_^
Believe me, it's a mistake that just about everybody has made at some point.
Topic archived. No new replies allowed.