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 220 views
1 answer 186 views
1 answer 209 views
1 answer 232 views
1 answer 133 views
1 answer 215 views
...