fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. string str;
  9. cout<< "upisi recenicu do 255 sloava : " << endl;
  10. getline (cin,str);
  11.  
  12. unsigned int lowercaseLetters = 0;
  13. unsigned int uppercaseLetters = 0;
  14.  
  15. for(unsigned int index = 0 ; index < str.size() ; index++)
  16. {
  17. if( isalpha( str[index]) )
  18. {
  19. if( islower( (char)str[index] ) )
  20. lowercaseLetters++;
  21.  
  22. else
  23. uppercaseLetters++;
  24.  
  25. }
  26. }
  27.  
  28. cout<< endl << "malih slova : " << lowercaseLetters << endl;
  29. cout<< endl << "velikih slova : " << uppercaseLetters << endl;
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 2860KB
stdin
Ovo je jedna RECENICA. To nije broj 8!
stdout
upisi recenicu do 255 sloava : 

malih slova : 18

velikih slova : 10