1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changing Character case

Discussion in 'C++' started by Valiantangel, Apr 22, 2012.

  1. Valiantangel

    Valiantangel New Member

    Joined:
    Apr 14, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    I also came up with the below code still doesnt work

    Code:
    #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);
    }
     
    Last edited by a moderator: Apr 22, 2012
  2. Valiantangel

    Valiantangel New Member

    Joined:
    Apr 14, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Can someone help?
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    cout<<(char)toupper(s);

    This should be tolower and not toupper.
     

Share This Page