printf(), age question

when i run this code and put in an age it gives me a large negative number back, Im really new to learning c++ so stuck on simple questions sorry, if anyone could help it would be great thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  #include<iostream>
#include<string>

using namespace std;

int main()

{
	cout << "What is your name? " << endl;
	string name;
	cin >> name;

	cout << "what is your age" << endl;
	int age;
	cin >> age;

	printf("Hello there " "%s,", name.c_str());
	printf(" I see you are %d years of age");

	system("pause");
	return 0;
}
You've gotta tell printf what to print!

printf(" I see you are %d years of age",age);
Topic archived. No new replies allowed.