-
What is the output of this program?
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main ()
{
string str;
float p = 0;
int q = 0;
cout << "Enter item price: ";
getline (cin, str);
stringstream(str) >> p;
cout << "Enter item quantity: ";
getline (cin, str);
stringstream(str) >> q;
cout << "Total item price: " << p * q << endl;
return 0;
}
-
- 100
- Compilation Error
- Depends on entered value
- Runtime Error
- Garbage value
Correct Option: C
In this program, We are getting the input on runtime and manipulating the value.