#include #include using namespace std; int main(void) { string input; int num,total=0; bool more=true; while(more) { cout<<"Enter a number or Q to end:"; cin>>input; try { //try to convert string to int num=stoi(input); //converts string "12" or "12x" to the integer 12, but "$12" throws error total+=num; //add the value to total if conversion worked } catch(invalid_argument&) { //catch error if string cannot be converted to int if(input!="Q" && input!="q") cout<<"Cannot convert "<