How to check if a string contains only uppercase letters in C++

1 Answer

0 votes
#include <iostream> 
#include <algorithm>
  
using namespace std; 
    
int main() 
{ 
    string s = "CPPJAVAPHP";
  
    bool b = all_of(s.begin(), s.end(), ::isupper);
    cout << b;
      
    return 0; 
} 
  
  
  
  
/*
run:
  
1
  
*/

 



answered Feb 7, 2020 by avibootz

Related questions

...