Program 1010 1 I This program demonstrates the strcmp and at

Program 10-10 1 I/ This program demonstrates the strcmp and atoi functions. #include 3 #include 4 #include 5 #include 6 using namespace std; // For tolower /1 For strcmp // For atoi (program continues)

Solution

char input[SIZE]; //this is the declaration for input usedthe above in the above program

Since input is declared as char it doesn\'t read integers. And here comes the question why input is declared as char, since we are asking the user to enter a number or \'q\' to quit, we a variable which is capable of accepting both integers and character and hence we declared input as char as it accepts any type of data from the user. when \'q\' is entered the we stop accepting input from user else convert it to an integer and add it to total.

 Program 10-10 1 I/ This program demonstrates the strcmp and atoi functions. #include 3 #include 4 #include 5 #include 6 using namespace std; // For tolower /1

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site