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);
}

Recommended Answers

All 2 Replies

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);
}
cout<< "Name your favourite soccer team in uppercase\n";

    cin>>s;
    if (isupper(s))
       cout<<toupper(s[0]);
    else
       cout<<s;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.