Problems with addition

Okay I know I've been asking a lot of questions, but I need this to work. Here's my problem; I tried to do a semi-simple math problem, which is "If your (age) then how old will you be in 10 years". Here is the code I used. It's giving so many errors. The string "age" has already been made earlier in the code.

1
2
3
4
5
6
7
8
9
10
11
12
13
    Sleep(500);
    cout<<endl;
    cout<<"If your'e "<<age<<" then how old will you be in 10 years?\n"<<endl;
    int nage;
    cin>>nage;
if (nage == age + 10)
{
    cout<<"Your'e right! good job\n";
}
else 
{
    cout<<"Are you serious, come on, it's simple addition!\n";
}
Last edited on
Alright, if this isn't the FULL program, you're forgetting a few things.
Also, get rid of that sleep function, why do you need that?

You need to declare the variable age.
Just saw you already declared age. You are declaring nage a int, and age is a string, you can not compare a string to an int variable, they both need to be int OR both need to be string.
Last edited on
Thanks bro! I got it work by changing "age" to an "int". Thanks, MaxDaniels for the info!
Glad I could help, I'm still learning too!
Topic archived. No new replies allowed.