Answer to Question #313442 in C++ for masroor bin rehan

Question #313442

Write a program that will ask user to enter a digit character (i.e. ‘0’ or ‘1’ .... or ‘9’). If user

enters a non-digit character then the program should display message to re-enter correct input. If user

enters a correct character (i.e. a digit character) then your program should convert that character to

a same digit but in integer type. Do this for five inputs. Finally, add all digits and display their sum. Do

not use any library function or loops.


1
Expert's answer
2022-03-17T15:18:29-0400

Here is program:

int main()
{
	string x;
	try
	{
		cin >> x;
	}
	catch (exception exp)
	{
		cout << "Error" << endl;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog