Adding string lowering example

This commit is contained in:
left_adjoint 2024-01-19 12:56:44 -08:00
parent d2366ac685
commit 9248b5b621
1 changed files with 20 additions and 0 deletions

20
stringLower.cpp Normal file
View 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;
}