C/C++の宿題を片付けます 93代目at TECH
C/C++の宿題を片付けます 93代目 - 暇つぶし2ch416:デフォルトの名無しさん
07/07/20 13:15:02
>>363
#include <stdio.h> #include <string.h> #include <ctype.h>
#define SIZE 500
int main()
{ char English[SIZE] = {'\0'}; char Other[SIZE] = {'\0'};
char buff[SIZE]= {'\0'}; char *temp; int i,j=0,k=0; int len;
fgets(buff,sizeof(buff),stdin); if(temp = strchr(buff, '\n'))
*temp = '\0';
for(i = 0; buff[i] != '\0'; i++){
if(isalpha(buff[i]))
English[j++] = buff[i];
else
Other[k++] = buff[i];
}
printf("English %s Other %s \n",English,Other);

printf("英文字入力\n");
fgets(buff,sizeof(buff),stdin);
if(temp = strchr(buff, '\n'))
*temp = '\0';
printf("削除文字入力\n");
fgets(Other,sizeof(Other),stdin);
if(temp = strchr(Other, '\n'))
*temp = '\0';
len = strlen(Other);
while(temp = strstr(buff,Other)){
memcpy(temp,temp+len,sizeof(buff));
}
printf("削除後 %s \n", buff);

return 0;
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch