-
What is the output of this program?
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
stringstream strstream(ios :: in | ios :: out);
std :: string data("The double value is : 12.25 .");
strstream.str(data);
strstream.seekg(-5, ios :: end);
double value;
strstream >> value;
value = value*value;
strstream.seekp(-5,ios::end);
strstream << value;
std :: string new_value = strstream.str();
cout << new_value;
return 0;
}
-
- 12.25
- Compilation Error
- 120.0625
- Runtime Error
- None of these
Correct Option: C
In this program, We have used the string hierarchy to compute the square of the number.