1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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

    This should be tolower and not toupper.
     

Share This Page