please help me

How to write a program that defines an integer variable named age and a float variable named weight. Store your age and weight as literals in the variables. The program should display these values on the screen in a manner similar to the following:
Program Output
My age is 26 and my weight is 180 pounds.
You will need to read the following article:

http://www.cplusplus.com/reference/iostream/cout/

Here is a hint:
1
2
 
int x = 0; //This creates an integer, called x, and assigns it a value of 0.  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

using namespace std;

int main()
{
int age;
float weight;

cout<<"Please enter your age: \n";
cin>>age;
cout<<"Please enter your Weight: \n";
cin>>weight;

cout<<"My age is " <<age<< " and my weight is " <<weight<<endl;
return 0;
}

or
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

using namespace std;

int main()
{
int age = 26;
float weight = 180;
cout<<"My age is " <<age<< " and my weight is " <<weight<<endl;
return 0;
}


note: In the future, make sure to provide your own attempt, and read the rules.
Last edited on
Topic archived. No new replies allowed.