Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这样进行字符串操作不可以吗?为什么会自动回车,好像最后有了回车就会错……

Posted by prowind at 2008-12-31 15:17:59 on Problem 2141
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator