Please help me !!!!

Hi Everyone,

I just started playing around with C++ with Xcode, but this happened to me when I run the code, the line "Program ended with exit code: 0" appear towards in the beginning of the output. Please help me to fix it.


This is my code:

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
31
32

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main()

{
    int test1 = 100, test2 = 90, test3 = 85;
    string name;
    char mychar;
    
    
    
    cout << "Enter your name: " << endl;
    cin >> name;
    
    
    cout << name << "\'s Grades" << endl;
    
    cout << setw(8) << "Test 1: " << setw(4) << test1 << endl;
    cout << setw(8) << "Test 2: " << setw(4) << test2 << endl;
    cout << setw(8) << "Test 3: " << setw(4) << test3 << endl;
    
    cout << endl;
    
    
    

    return 0;
}


And this is my output:

Enter your name:
Program ended with exit code: 0Hiep
Hiep's Grades
Test 1: 100
Test 2: 90
Test 3: 85

If that message is indeed before your program's "output" then is probably from your compiler/linker telling you that your program compiled and linked properly.

If that message is at the end of the program's "output" then it is just telling you that your program ended normally.

Topic archived. No new replies allowed.