Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   please click here (imp) (http://www.go4expert.com/forums/click-imp-t24257/)

wafa 24Dec2010 19:23

please click here (imp)
 
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;
}


virxen 24Dec2010 19:39

Re: please click here (imp)
 
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;
}


wafa 24Dec2010 19:44

Re: please click here (imp)
 
yesssssssss

than u ur my Teacher

that's code worke

iam so happy thanx alot


All times are GMT +5.5. The time now is 06:00.