Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
#include
3.
using namespace std;
4.
int main()
5.
{
6.
stringstream mys(ios :: in | ios :: out);
7.
std :: string dat("The double value is : 74.79 .");
8.
mys.str(dat);
9.
mys.seekg(-7, ios :: end);
10.
double val;
11.
mys >> val;
12.
val = val*val;
13.
mys.seekp(-7,ios::end);
14.
mys
Options:
A .  5593.54
B .  Error
C .  Runtime error
D .  None of the mentioned
Answer: Option A

In this program, We have used the string hierarchicy to compute the square of the number.
Output:
$ g++ class.cpp
$ a.out
The double value is : 5593.54 .



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers