What's wrong with this?

What is wrong with this code? why does it play thought the whole thing without any user input at the choices? and why do the names display as random numbers after you put it in?

And also please feel free to give me tips on how to improve this code please.:D
Any help would be great, thank you for reading.

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <string>

using std::cout;
using std::cin;
using std::endl;
using std::string;

main()
{
    //setting infomation
            const int GOLDEN_COINS = 2000, MAX_ITEMS = 10;
        int NAME, TEAM, choice1;

     //Getting the information from player.

    {
        //Players name
        {
        cout << "\t Hello and welcome to my text based game - By kevindav1.";
        cout << "\n Please enter your";
        cout << "name: ";
        cin >> NAME;

        cout << "\n\nYour name is " << NAME << ". Is this correct?";

        // Are you sure loop
        {
            cout << "Thank you for giving us your name," << NAME << ".";
            cout << " Are you sure?";
            cout << "\n\nYes - 1\n\nNo - 2";
            cout << "\n\nChoice: ";
            cin >> choice1;



            switch (choice1)
            {
                case 1:
                        break;
                case 2:
                        cout << "You have one last chance to get this right.";
                        cout << "\n Please enter your name: ";
                        cin >> NAME;
                        break;
            }
            cout << "Thank you for giving us your name," << NAME << ".";
        }
        }

    }

    //How many people are in there squad?
    {
        cout << "How many people are in your special forces squad?";
        cout << "Number: ";
        cin >> TEAM;

        cout << "Are you sure " << NAME << "? That's quite i nice size squad of " << TEAM <<".";
    }

}




On the console window when i play it, it says "please enter your name: "Then i enter "hello".

Then it says "Thank you for giving us your name,4273392."

1
2
3
4
5
cout << "\n Please enter your";
        cout << "name: ";
        cin >> NAME;

        cout << "\n\nYour name is " << NAME << ". Is this correct?";
Line 13: int NAME. "hello" is not an integer ...
Maybe you meant the declaration string NAME instead of int NAME?
I see the problem now and thanks for your help.
Also just because it lets you compile without int infront of main doesn't mean you should. It is best do do int main
That is like saying just because you can compile 1 as a double you should it should really be an int/short.
it's best to use getline(cin,name); in case the user enters their first and last name.
Topic archived. No new replies allowed.