please click here (imp)

wafa's Avatar
Light Poster
hello every one this programme do kaptel letter but i want chang when the word have small letter change to kapter and when have kapter chang to small i try this code

but it gust kapter letter
i need like this
user in put
cin>>WElcoME
cout<<weLCOme//this out put<<

this my code""

#include
<iostream>

#include
<string>

int
main()
{
std::
string line;

std::cout
<<"Enter your a line of text: ";

if ( getline ( std::cin, line ) ) {
// Make the line all upper case

for ( std::string::size_type i = 0; i < line.size(); i++ )
line
[i] = std::toupper ( line[i] );

std::cout<< line <<
'\n';
}
return 0;
}

0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
try this

Code:
#include <iostream>

int main(){
    std::string line;
    std::cout<<"Enter your a line of text: ";
    if ( getline ( std::cin, line ) ) {
        for ( std::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]);
        std::cout<< line <<'\n';
    }
    getchar();
return 0;
}
0
wafa's Avatar
Light Poster
yesssssssss

than u ur my Teacher

that's code worke

iam so happy thanx alot