Guest User

Untitled

a guest
Apr 22nd, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <cctype>
  3.  
  4. using namespace std;
  5.  
  6. int howmanyupper (char[]);      //function prototype
  7.  
  8. int main()
  9. {
  10.     char lastday[] = "THE Last Day of SCHOOL";
  11.    
  12.     cout<<"The number of uppercase letters in this statement is "<<howmanyupper(lastday)<<endl;
  13.  
  14.     return (0);
  15. }
  16.  
  17. int howmanyupper(char up [])
  18. {
  19.     int length, numofcapital(0);
  20.     length = strlen(up);
  21.    
  22.     for (int k = 0; k < length; k++)
  23.     {
  24.         if (isupper(up[k]) != 0)
  25.         {
  26.             cout<<up[k]<<" ";
  27.             numofcapital++;
  28.         }
  29.     }
  30.    
  31.     return numofcapital;
  32. }
Add Comment
Please, Sign In to add comment