1111: 单词调换位置
Time Limit: 1 Sec Memory Limit: 128 MBDescription
将用逗号隔开的两个英语单词交换位置输出
Input
一行以逗号隔开的两个单词
Output
将两个单词交换后输出
Sample Input
abc,de
Sample Output
de,abc
HINT
Source
#include<iostream>
#include<string.h>
using namespace std;
main()
{
char s[10000],t[10000];
int i=0;
while(cin>>s[i])
{
if(s[i]==',')
{s[i]='\0';break;}
i++;
}
cin>>t;
strcat(t,",");
cout<<t<<s<<endl;
}

本文介绍了一个简单的程序设计问题——如何交换两个逗号分隔的英文单词的位置并输出。该程序使用C++语言实现,通过读取一行包含两个由逗号隔开的单词,然后将这两个单词的位置互换后输出。
880

被折叠的 条评论
为什么被折叠?



