C/C++の宿題を片付け ..
[2ch|▼Menu]
187:デフォルトの名無しさん
08/02/11 20:00:14
>>186
#include <iostream>
using namespace std;

bool hasDigit( const char* pstr )
{
while(*pstr) {
if( isdigit(*pstr) )
return true;
pstr ++;
}
return false;
}

int main()
{
while(1) {
cout << "入力=";
char sz[50];
cin.getline( sz, sizeof(sz) );
if( !hasDigit( sz ) ) {
char* p;
for( p=sz; *p=='a'; p++ );
cout << "出力=" << p << "\n";
break;
} else {
cout << "数値が含まれるので、再度入力してください。\n";
}
}
return 0;
}


次ページ
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4969日前に更新/299 KB
担当:undef