Adding string lowering example
This commit is contained in:
parent
d2366ac685
commit
9248b5b621
20
stringLower.cpp
Normal file
20
stringLower.cpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <cctype>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
string wholeLower(string s){
|
||||||
|
for(int i = 0; i < s.length(); i++){
|
||||||
|
s[i] = tolower(s[i]);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
string ourStr;
|
||||||
|
cout << "Enter a string. Just try to yell if you can!" << endl;
|
||||||
|
cin >> ourStr;
|
||||||
|
|
||||||
|
ourStr = wholeLower(ourStr);
|
||||||
|
cout << "Here's the string you entered (but whispering) " << ourStr << endl;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user