Question: Given the following program, i get this error. How do i fix my code?Here is the error that shows up : Program generated too much
Given the following program, i get this error. How do i fix my code?Here is the error that shows up :
Program generated too much output. Output restricted to characters. Check program for any unterminated loops generating output.
This is the code used for the program:
#include #include #include #include using namespace std; int main string title, colHeader, colHeader; vector dataStrings; vector dataIntegers; cout "Enter a title for the data: ; getlinecin title; cout "You entered: title endl; cout "Enter the column header: ; getlinecin colHeader; cout "You entered: colHeader endl; cout "Enter the column header: ; getlinecin colHeader; cout "You entered: colHeader endl; while true cout "Enter a data point to stop input: ; string input; getlinecin input; if input break; sizet commaPos input.find; if commaPos string::npos cout "Error: No comma in string." endl; continue; sizet secondCommaPos input.find commaPos ; if secondCommaPos string::npos cout "Error: Too many commas in input." endl; continue; string dataString input.substr commaPos; string dataIntegerStr input.substrcommaPos ; try int dataInteger stoidataIntegerStr; dataStrings.pushbackdataString; dataIntegers.pushbackdataInteger; cout "Data string: dataString endl; cout "Data integer: dataInteger endl; catch const invalidargument& cout "Error: Comma not followed by an integer." endl; continue; cout setw right title endl; cout setw colHeader setw colHeader endl; for sizet i ; i dataStrings.size; i cout setw right dataStringsi setw dataIntegersi endl; cout "Histogram:" endl; for sizet i ; i dataStrings.size; i cout setw right dataStringsi; for int j ; j dataIntegersi; j cout ; cout endl; return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
