It's probably because of a simple mistake but why isn't this loop working, the one im talking about is the for loop at the bottom, it's suppose to convert whatever they enter to lowercase and then display it but for some reason it only handles the first letter
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
for(bool loop(true);loop=true;){
cout<<"Enter The Conversion Type (Type H For A List):";
string Conversion_Type;
getline(cin,Conversion_Type);
for(int i=0;i<Conversion_Type.length();i++){
Conversion_Type=tolower(Conversion_Type[i]);
cout<<Conversion_Type;}
cin.ignore();}}
It needs to be Conversion_Type[i]=tolower(Conversion_Type[i]);
I doubt the first loop is doing what it is supposed to do either. You probably meant loop==true (which is equivalent to loop).
u guys sure will the code get the correct output?
as i see: cout<<Conversion_Type;}
the loop bracket is at the end of cout
so i think it should be: cout<<Conversion_Type[i];}
rite?
or u can change the "}" to line Conversion_Type=tolower(Conversion_Type[i]);}
actually, i had to remove cout<<Conversion_Type altogether because if i left it in the loop i was getting something similar to for example if i entered HELP I would get hELPheLPhelPhelp lol