Skip to content

Commit

Permalink
Update ex6_17.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Jun 22, 2015
1 parent b0fea80 commit 4cf83d3
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions ch06/ex6_17.cpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
#include <iostream>
#include <string>

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

bool hasUppercase(const string &str)
bool any_capital(string const& str)
{
for (auto c : str)
if (isupper(c)) return true;
for (auto ch : str)
if (isupper(ch)) return true;
return false;
}

void makeLowercase(string &str)
void to_lowercase(string& str)
{
for (auto &c : str)
if (isupper(c)) c = tolower(c);
for (auto& ch : str) ch = tolower(ch);
}

int main()
{
string str("Hello World!");
cout << hasUppercase(str) << endl;
makeLowercase(str);
cout << str << endl;

string hello("Hello World!");
cout << any_capital(hello) << endl;

to_lowercase(hello);
cout << hello << endl;

return 0;
}

0 comments on commit 4cf83d3

Please sign in to comment.