| ||||||||||
| 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 | |||||||||
这样进行字符串操作不可以吗?为什么会自动回车,好像最后有了回车就会错……#include <iostream>
using namespace std;
int main()
{
int i;
char a[100],ch[100],ch2;
scanf("%s",ch);
for (i=0;i<26;i++)
a['a'+i] = ch[i],a['A'+i] = 'A'+ch[i] - 'a';
getchar();
while((ch2=getchar())!='\n')
{
printf("%c",a[ch2]);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator