write a c++ statement as following :
a. Declare int variable num1 and num2.
b. Prompt the user to input two numbers
c. Input the first number in num1 and the second number in num2.
d. Output num1, num2, and 2 times num1 minus num2. Your output must identify each
number and the expression
e. Declare a double named salary
f. Assign 15 to x and y
g. Input the user’s age
h. Initialize total to 0
i. Declare a variable named address to store 15 characters.
j. Declare a constant as float and assign it to 0.125
Statement in C++
k. Declare three variables as integer. Initial the first variable to 10.
l. Declare 5 variables, whereby the first three variables are float and the last two
variables are integer
#include <iostream>
using namespace std;
int main()
{
int num1, num2;
cout<< "Enter num1 and num2: ";
cin>> num1>>num2;
cout<< "Num1 = " << num1 << " and Num2 = " << num2 << endl;
cout << "num1-num2 = " << num1-num2 <<"num1-num2 = " << num1-num2 << endl;
double salary;
int x=15;
int y=x;
cout << "Input your age" << endl;
char address[15];
const float gg=0.125;
int firts=10, second, third;
float a1,a2,a3;
int a4,a5;
return 0;
}
Comments
Leave a comment