| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
测试是对的,怎么老是WA,帮忙看看啊!#include "iostream"
#include "string"
using namespace std;
int main()
{
char str1[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',
'p','q','r','s','t','u','v','w','x','y','z'};
char str2[26];
char str4[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
'P','Q','R','S','T','U','V','W','X','Y','Z'};
char str3[81];
for(int m=0;m<26;m++)
cin>>str2[m];
cin.ignore(1024,'\n');
getline(cin,str3);
int n;
n=str3.length();
for(int i=0;i<n;i++)
{
if(i==0)
{
for(int q=0;q<26;q++)
{
if(str3[0]==str4[q])
{
for(int r=0;r<26;r++)
{
if(str2[q]==str1[r])
str3[0]=str4[r];
}
break;
}
}
}
else
{
for(int j=0;j<26;j++)
{
if(str3[i]==str1[j])
{
str3[i]=str2[j];
break;
}
}
}
}
for(i=0;i<n;i++)
cout<<str3[i];
cout<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator