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,375
    Likes Received:
    388
    Trophy Points:
    83
    cout<<(char)toupper(s);

    This should be tolower and not toupper.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice