Will this work?

I was wondering if you guys could tell me if my code is proper and will work while I'm searching for a way to launch it.

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
#include <iostream>

using namespace std

int main()
{
	cout << "Enter your name." << endl;
	int name;
	cin >> name << endl;
	cout << "How old are you?" << endl;
	int age;
	cin >> age;
	if(age >= 18) {
	cout << "You are a" << age << "year old man named" << name << "correct?" << endl;
	}else{
		cout << "You are a" << age << "year old boy named" << name << "correct? Y/N." << endl;
	}
	int Y = 51;
	int N = 50;
	cin >> answer;
	if(answer == Y){
		cout << "I'll think of something to put here later." << endl;
	}else{
		for(int x = 1; x == 1)
	}
}
Will this work?

Get an IDE (for example visual studio), and try it yourself.
(and no, it won't work).
There are quite a lot of mistakes in this code..
* you cant store more than 1 digit in int.. so you need to use string for the name
*and use char for Y/N not int

read more about strings and type char.. and as he said get an IDE. I personally use code blocks
but there are many other good ones.
you cant store more than 1 digit in int

Sorry to be pedantic, but '1234' is a 4-digit number, and this can be stored in an int
I think I know what you meant though :)
Thank you guys for the feedback! I'll change it accordingly.
Topic archived. No new replies allowed.