Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
#include
3.
using namespace std;
4.
string askNumber(string prompt = "Please enter a number: ");
5.
int main()
6.
{
7.
string number = askNumber();
8.
cout
Options:
A .  5
B .  6
C .  the number you entered
D .  compile time error
Answer: Option C

In this program, we are getting a number and printing it.
Output:
$ g++ def1.cpp
$ a.out
Please enter a number:
5
Here is your number:5



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers