Question
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
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
Answer: Option A
Was this answer helpful ?
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 ?
Submit Solution