Answer to Question #44822 in C++ for Yahya
2014-08-09T02:27:03-04:00
//3. Read in characters from the user until user enters 'z', then print out how many a's were entered
The below program does not count the number of 'a' the user has inputted. Please see the code below.
Do I need to use array or I can do it without array, if yes please let me know how without using array.
#include <iostream>
using namespace std;
void main ()
{
char letter;
int x=0;
cout << "Please enter letter(s): ";
cin >> letter;
while (letter=='a')
{
x = letter+1;
if (letter!= 'z')
{
cin >> letter;
}
}
cout << "The number(s) of letter 'a' entered is/are: " << x << endl;
system ("pause");
}
1
2014-08-12T10:34:59-0400
The answer to the question is available in the PDF file https://assignmentexpert.com/https://assignmentexpert.com/homework-answers/programming-answer-44822.pdf
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 !
Learn more about our help with Assignments:
C++
Comments
Leave a comment