I'm trying to write a peice of code that will convert all the uppercase characters in a word to lowercase, and to store that in an array. I know how to convert individual characters, and to output all these characters in the fixed lower case.
The thing i'm unsure about is how to use this information to store the whole lowercase word in an array, because what my program outputs is a sequence of characters, rather then a word.
#include <iostream>
#include <cctype>
using namespace std;
int main(){
string input;
char ch;
cout<<"Enter a word: "<<endl;
cin>>input;
for (int i = 0; i < input.size(); i++){
if (isupper(input.at(i))){
ch=tolower ( input.at(i) );
cout<<ch;
}else{
cout<<input.at(i);
}
}
}
Here's my code so far. Any help is kindly appreciated.