0

hi
i am trying to change an input from upper case to lowercase.I am not getting it right.When i key in say Liverpool or TIGERS it only show l and t respectively.
Need assistance

#include <iostream>
#include <cctype>
#include<iostream>

using namespace std;

int main()
{
   char s;
   cout<<"Name your favourite soccer team in uppercase\n";
   cin.get(s);

  if(isupper(s))
  {
      s=tolower(s);     //is this correct?
  cout << s <<'\n';
  }
  else "re-type";

    return(EXIT_SUCCESS);
}
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by triumphost
0

I also came up with the below code still doesnt work

#include <iostream>
#include <cctype>

using namespace std;

int main()
{
   char s;
   cout<<"Name your favourite soccer team in uppercase\n";

   while (cin.get(s));
   {
    if(isupper(s))
       cout<<(char)toupper(s);
    else
       cout<<s;
   }

    return(EXIT_SUCCESS);
}
0
cout<< "Name your favourite soccer team in uppercase\n";

    cin>>s;
    if (isupper(s))
       cout<<toupper(s[0]);
    else
       cout<<s;

Edited by triumphost

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.