Wap to count no. Of capital letters in a string? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Wap to count no. Of capital letters in a string?

24th Dec 2016, 7:52 AM
Mayur Kumar
Mayur Kumar - avatar
2 ответов
+ 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.
24th Dec 2016, 8:06 AM
Wen Qin
Wen Qin - avatar
+ 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; }
24th Dec 2016, 8:06 AM
Ravi Kumar
Ravi Kumar - avatar