MUstar

IoT C언어 0626 - ex_01_0

Jun 26th, 2017
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. void print_graph(int *ps, int size);
  4.  
  5. int main(void)
  6. {
  7.     int cnt=0, temp_num;
  8.     int *score;
  9.    
  10.     printf("점수를 입력하세요. 입력종료는 -1을 입력하세요.\n");
  11.     while(1)
  12.     {
  13.         printf(">");
  14.         scanf("%d", &temp_num);
  15.         if(temp_num>=0)
  16.         {
  17.             score[cnt] = temp_num;
  18.             cnt++;
  19.         }
  20.         else if(temp_num<0) break;
  21.         else
  22.         {
  23.             printf("입력오류! 다시입력해주세요.\n");
  24.             printf("----------------\n");
  25.         }
  26.     }
  27.    
  28.     for(int i= 0;i<cnt;i++)
  29.     {
  30.         print_graph(&score[i],score[i]/5);
  31.     }
  32.  
  33.     return 0;
  34. }
  35.  
  36. void print_graph(int *ps, int size)
  37. {
  38.     if(*ps<10)printf("(  %d) ",*ps);
  39.     else if(*ps<100)printf("( %d) ",*ps);
  40.     else printf("(%d) ",*ps);
  41.     for(int i=0;i<size;i++)
  42.     {
  43.         //printf("*");
  44.         printf("|■");
  45.     }
  46.     printf("|\n");
  47. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×