hello everyone in need of a little help here.i am beginner to programing and i have to produce a program that

1 outputs a message to the moniter asking the user their age as a whole number
2 use the input method to obtain a whole number from the user and store this number in a variable.the user will enter the number using the keyboard
3 then output a new message to the moniter telling the user how old they will be in 10 years.
i hsve come up with this but it wont run any suggestions would be much appreciated thanks kjsalk

using namespace std;

int main()
{
    int age = 0;
    cout <<"please enter your age :";
    cin >> age;
     age = 10 + age;

    cout <<"your age in ten years will be"<< age << endl ;
    return 0;
}

Doesn't seem to be anything wrong with it !

Are you having a problem with the code ending immediatly after entering a variable ?

Do use

tags in the future, makes it easier to read your code.

comes up with this error message
1>C:\Documents and Settings\HP_Owner\Desktop\assisnment\kjsalk\Debug\kjsalk.exe : fatal error LNK1120: 1 unresolved externals

- Which compiler are you using ?
- Have you created a console application ?

- Is this the code you entered:

#include <iostream>

using namespace std;

int main()
{
	int age = 0;
	cout <<"please enter your age :";
	cin >> age;
	age = 10 + age;

	cout <<"your age in ten years will be"<< age << endl ;

	return 0;
}

cheers for your reply jobe i've now worked out wot was wrong and it works perfectly thanks again kjsalk

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.