C++

C++: write a c++ program that will display your name, address and age...pls... help me
[half-joking]Will you pay me?[/half-joking]

Seriously no one's going to do your homework for you (unless you pay them or something of the like.

If you want free help then post what you have so far and any troubles you're currently having.
Wouldn't this belong under beginners? Anyways I will give you a few tips of my fedora. This project will require the iostream header. If you write using namespace std; before you declare int main() then things get easier. Also, int main() is where you want to write your code using curly brackets. Use a string variable to record answers and cout to display them.

example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <conio.h> //not needed

using namespace std;

int main()
{
string name;
string age;
int dump; //extra variable not needed
cout<< "what is your name?\n"; //this will put the text on the screen
cin>> name; //this stores the answer as 'name'
cout<< "\nHow old are you?\n"; //ask a question
cin>> age; //guess what this stores
cout<< "\nYour name is ";
cout<< name; //notice there are no quotes around the variable
cout<< ". You are ";
cout<< age;
cout<< " years old.";
dump = getch(); //this line is not needed
}


I know C++ seems complicated at first but you will eventually get good at it.
tnx po.......
Topic archived. No new replies allowed.