Do While Loop problem

When I tried compile the Do-While Loop tutorial program, the compiler (CodeBlocks) writted:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

using namespace std;

int main()
{
    unsigned long n;
    do
    {
        cout << "Enter a number (0 to end): ";
        cin >> n;
        cout << "You entered" << n << "!"'/n';
    }
    while (n != 0);
    cin.get();
}


C:\Codes\C++\C++ Projects\DoWhile.c|12|warning: multi-character character constant|
C:\Codes\C++\C++ Projects\DoWhile.c||In function `int main()':|
C:\Codes\C++\C++ Projects\DoWhile.c|12|error: expected `;' before '\x2f6e'|
C:\Codes\C++\C++ Projects\DoWhile.c|15|error: statement cannot resolve address of overloaded function|
||=== Build finished: 2 errors, 1 warnings ===|

Why?

Edit: Noticed one error >.>" But the other...
Last edited on
cout << "You entered" << n << "!"'/n';

You are probably trying to do this:

cout << "You entered" << n << "!\n";

There is no need to surround them with '', just put it directly into the string. Also, your escape \ was the incorrect one.
Last edited on
Ok :) Thanks!
Topic archived. No new replies allowed.