0
Wap to count no. Of capital letters in a string?
2 Respostas
+ 3
It is possible using loops. But the simplest, easiest ,laziest and the fastest method is to use more systems.
I just made one here : https://code.sololearn.com/cWyLfjIs26u4/#cpp
Basically I makes use of these 2 systems :
#include <cctype>
#include <string>
Use #include <algorithm> to detect digits/numbers, I think there is one more for syntaxs though, I kind of forgot it, you can try googling it.
+ 2
#include <iostream>
using namespace std;
int main()
{
int i, count=0;
char str[25]={"C++DeveloperFromINDIA"};
for(i=0;i<25;i++)
if(str[i]>64 && str[i]<91)
count++;
cout<<"No. of Capital Letters : "<<count;
return 0;
}