CLICK here<<(imp)

Discussion in 'C++' started by wafa, Dec 28, 2010.

  1. wafa

    wafa New Member

    Joined:
    Dec 24, 2010
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    this code chang capter letter to small and small to capter
    Code:
     
    #include <iostream>
    using namespace std;
    
    int main(){
        string line;
       cout<<"Enter your a  text: ";
        if ( getline ( cin, line ) ) {
            for ( string::size_type i = 0; i < line.size(); i++ )
                if (isupper(line[i]))
                     line[i]=tolower(line[i]);
                else if (islower(line[i]))
                     line[i]=toupper(line[i]);
            cout<< line <<'\n';
        }
      
    return 0;
    }
    BUT HOW I CAN USE FUNCTION IN THIS PROGRAMME_??:undecided
     
    Last edited by a moderator: Dec 30, 2010

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