C言語なら俺に聞け(入門編)Part 63at TECH
C言語なら俺に聞け(入門編)Part 63 - 暇つぶし2ch919:デフォルトの名無しさん
10/05/13 01:18:41
>>915
#include <stdio.h>
#include <ctype.h>

/* function prototype */
void disp_char( int );

int main( void )
{
 char no;
 printf( "整数を入力してください:" );
 scanf( "%c", &no );

 if( isdigit( no ) == 0 ) {
  printf( "Error:数値以外の文字が入力されました\n" );
 } else {
  disp_char( no - '0' );
 }
  return 0;
}

void disp_char( int t )
{
 int i;
 char c = '*';

 for( i = 1; i <= t; i++ ) {
  printf( "%c", c );
 }
 printf( "\n" );
}


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