C++ PROGRAM
Link will be apear in 30 seconds.
Well done! you have successfully gained access to Decrypted Link.
Textbook Solution:
Answer:
Program Plan Intro
Program plan:
- Declare the variable number of integer type.
- The cout statement is used to prompt a message to user and display output.
- The cin statement is used to take an input from user.
Program description:
The following program will take an input from user and display its integer output.
Program Explanation
Program
//header file included
#include<iostream>
//namespace included
usingnamespace std;
//main function
intmain()
{
//Declare variable number of int type
int number;
//cout statement
cout<<"Enter a number:"<<endl;
//cin statement
cin>>number;
//display output
cout<<number;
//exiting from program
return 0;
}
Explanation:
In the above program, inputted number from a user using cin statement. Displayed the inputted number immediately using cout statement.
Observed output:-
if inputted number is of integer type then displayed output is also the same number.
if inputted number is of double-precision type then displayed output is also only the integer part of number.
if inputted number is of character type then displayed output is 0.
Sample Output: