C/C++の宿題を片付け ..
[
2ch
|
▼Menu
]
■コピペモード
□
スレを通常表示
□
オプションモード
□このスレッドのURL
■項目テキスト
181:デフォルトの名無しさん 08/02/11 14:54:09 >>180 #include <iostream> #include <string> using namespace std; int main() { while(1) { cout << "入力="; string s; cin >> s; if( s.find_first_of( "0123456789" ) == string::npos ) { cout << "出力=" << s.substr( s.find_first_not_of( "a" ) ) << "\n"; break; } else { cout << "数値が含まれるので、再度入力してください。\n"; } } return 0; } 182:デフォルトの名無しさん 08/02/11 18:40:08 >>180 #include <stdio.h> #include <string.h> int main(void) { char str[256]; int top; printf("入力:"); start: top=0; fgets(str,256,stdin); again0: if(str[top]>=48&&str[top]<=57){ printf("再入力:"); goto start; } if(top++<strlen(str))goto again0; top=0; again1: if(str[top]=='a'){ top++; goto again1; } printf("出力:"); again2: printf("%c",str[top++]); if(str[top]!=NULL)goto again2; return 0; }
次ページ
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
レスジャンプ
mixiチェック!
Twitterに投稿
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch
4989日前に更新/299 KB
担当:undef