How to check if given string contains all uppercase letters in C++

1 Answer

0 votes
#include <iostream>
#include <algorithm>

using std::cout;
using std::endl;
using std::string;

int main()
{
	string s = "CPHPJAVA";

	bool result = std::all_of(s.begin(), s.end(), isupper);

	if (result)
		cout << "yes" << endl;
	else
		cout << "no" << endl;

	return 0;
}


/*
run:

yes

*/

 



answered Feb 5, 2018 by avibootz

Related questions

1 answer 221 views
1 answer 187 views
1 answer 210 views
1 answer 233 views
1 answer 134 views
1 answer 216 views
...