Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- using namespace std;
- int howmanyupper (char[]); //function prototype
- int main()
- {
- char lastday[] = "THE Last Day of SCHOOL";
- cout<<"The number of uppercase letters in this statement is "<<howmanyupper(lastday)<<endl;
- return (0);
- }
- int howmanyupper(char up [])
- {
- int length, numofcapital(0);
- length = strlen(up);
- for (int k = 0; k < length; k++)
- {
- if (isupper(up[k]) != 0)
- {
- cout<<up[k]<<" ";
- numofcapital++;
- }
- }
- return numofcapital;
- }
Add Comment
Please, Sign In to add comment