Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int UpperCount(char* str)
- {
- int counter = 0;
- for(int i = 0; str[i] != '\0'; i++)
- {
- if((int)str[i] > 64 && (int)str[i] < 91) counter++;
- }
- return counter;
- }
- int main()
- {
- char* str = nullptr;
- char tmp[100];
- cout << "Enter your text\n";
- cin.getline(tmp,100);
- str = new char[strlen(tmp)+1];
- strcpy(str, tmp);
- cout << UpperCount(str) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement