- #include <iostream>
- #include <cstdio>
- #include <cctype>
- using namespace std;
- int main()
- {
- char* p;
-
- char str[80]="This is a Test";
-
- cout<<"Original string:"<<str<<'';
-
- p=str;
-
- while(*p){
-
- if(isupper(*p))
- *p=tolower(*p);
- else if(islower(*p))
- *p=toupper(*p);
-
- P++;
-
- }
-
- cout<<"Inverted-case string:"<<str<<endl;
-
- return 0;
- }
复制代码 |