A=islower('name[c]'); What exactly are you trying to do here? A is a boolean. Also name[c] returns a character so you don't need the single quotes around it.
*Edit One more thing, you should avoid magic numbers like 30.
A=islower('name[c]'); What exactly are you trying to do here? A is a boolean. Also name[c] returns a character so you don't need the single quotes around it.
single quotes are not needed.
'islower' funtion returns true, if the char is lower.
If the passed char is lower, then i am converting into Captital letter.
*Edit One more thing, you should avoid magic numbers like 30.
Can you explain you requirement with some example
What is input and output
'islower' funtion returns true, if the char is lower.
If the passed char is lower, then i am converting into Captital letter.
Whoops I though it said tolower, since that would convert only the alphabetic uppercase letters to lower otherwise return an unchanged letter(well really an int but same difference). Also, it was on his code not yours.
*Edit One more thing, you should avoid magic numbers like 30.
Can you explain you requirement with some example
What is input and output
Not sure what you are trying to say but basically you shouldn't use magic numbers like that. You should be using constant variables like: intconst maxLetters = 30;
I would just do
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include <string>
int main()
{
std::cout << "Please enter a sentence: ";
std::string sentence = "";
std::getline(std::cin, sentence);
for(char &it : sentence) //you can iterate anyway you want
//such as for(int i = 0; setence[i]; ++i)
//or even use std::transform(setence.begin(), setence.end(), sentence.begin(), ::tolower); //or toupper
{
it = tolower(it); //or toupper
}
std::cout << sentence << std::endl;
return 0;
}