Advertisement
TravDood

Chapter 10 Assignment 10 #28

Nov 17th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <cctype>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     const int SIZE = 5;
  9.     char input[SIZE];
  10.     char alphaCount = 0;
  11.  
  12.     cout << "Enter five characters: " << endl;
  13.     cin.get (input, SIZE);
  14.  
  15.     for (int count = 0; count < SIZE; count++)
  16.     {
  17.  
  18.         if (!isalpha(input[count]))
  19.             alphaCount += 1;
  20.     }
  21.  
  22.     cout << "The number of alphabetic characters your input contains is " << alphaCount << endl;
  23.  
  24.     system("pause");
  25.  
  26.     cin.ignore();
  27.     cin.get();
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement