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

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