Question: Fix this program (C++): Already written: #include #include #include using namespace std; int main() { string line; string text; int number; double decimal; istringstream sin;
Fix this program (C++):
Already written:
#include
#include
#include
using namespace std;
int main() {
string line;
string text;
int number;
double decimal;
istringstream sin;
while (getline(cin, line)) {
sin.clear();
sin.str(line);
if (sin >> number >> decimal >> text) {
cout
cout
}
else { cout
return 0;
} // end of int main()
This is what my current output looks like, and what it needs to look like. This is the instruction that I am failing to complete: "If you cannot get good data in all three, output "Bad Data: XXXXXX " and replace XXXXXX with the actual line you got from getline()"
Result Your Output Instructor Output Input cmd line arg Got: 11737 22.13 Hello Got: 11737 22.13 Hello Got: 22 0.13 3333 Got:22 0.13 3333 Got: 12 3.17 Gorp Got: 22 0.13 3333 Bad Data: Gosh Darn Me Got: 12 3.17 Gorp 11737 22.127 Hello 22.127 3333 129 Gosh Darn Me 12 3.17 Gorp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
