Answer:
The program to this question can be given as follows:
Program:
//header file
#include <iostream> //defining header file
using namespace std;
//main
int main() //defining main method
{
string name; //defining main method
cout<<"enter name: "; //print message
getline(cin,name); //using getline method
cout<<"The name you inserted is: "<<name; //print value
return 0;
}
Output:
Please Enter Name: Brenda Clinton
The name you inserted is: Brenda Clinton
Explanation:
Firstly the header file is included in the above C++ program code, in the next line the main method is defined, inside this method the string variable is defined which takes value from user-ends.
- In the above specifies the getline method, which can be referred to as a standard library feature for reading an input stream string or a line. It removes characters from the input stream and applies this to the string object until the character is delimited.
- After taking input the print method "cout" is used to print "name" variable value.
print('Welcome')
name = input('Please enter your name : ')
age = int(input('Your age : '))
print('Your name is',name,'and you have',age,'years old')
Answer:
result = 0
i = lo
while i <= hi:
result = result + i
i += 1
Explanation:
Initialize the <em>result</em> as 0 to hold the summation value.
Since we are asked not to change the value of <em>lo</em> and <em>hi</em>, our loop control variable is <em>i</em> and initially it starts from <em>lo.</em>
Since we are asked to add the number from <em>lo</em> to <em>hi, </em>while loop condition checks it.
While the condition satisfies (during each iteration), the value of <em>i</em> is added to the result and the value of <em>i</em> is incremented by one.
High Definition Television
Answer:A flowchart is a diagram that depicts the steps involved in solving a problem. The following flowchart shows how to output the multiplication table ( n * 1 to m * 1) of a number, n and m: