#include<bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int a;
char n;
while(cin>>a)
{
for(int i=1;i<=a;i++)
{
cin>>n;
if(n>='A'&&n<='Z')
{
n+=32;
cout<<n;
}
else if(n>='a'&&n<='z')
{
n-=32;
cout<<n;
}
else cout<<n;
}
}
}
#include<bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int a;
char n;
while(cin>>a)
{
for(int i=1;i<=a;i++)
{
cin>>n;
if(n>='A'&&n<='Z')
{
n+=32;
cout<<n;
}
else if(n>='a'&&n<='z')
{
n-=32;
cout<<n;
}
else cout<<n;
}
}
}
沒換行阿~~~~~大大
#include<bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int a;
char n;
while(cin>>a)
{
for(int i=1;i<=a;i++)
{
cin>>n;
if(n>='A'&&n<='Z')
{
n+=32;
cout<<n;
}
else if(n>='a'&&n<='z')
{
n-=32;
cout<<n;
}
else cout<<n;
}
}
}
沒換行阿~~~~~大大
謝謝!!
#include<bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int a;
char n;
while(cin>>a)
{
for(int i=1;i<=a;i++)
{
cin>>n;
if(n>='A'&&n<='Z')
{
n+=32;
cout<<n;
}
else if(n>='a'&&n<='z')
{
n-=32;
cout<<n;
}
else cout<<n;
}
}
}
沒換行阿~~~~~大大
謝謝!!
C++可用toupper(),tolower()