MUstar

IoT C언어 0626 - ex_01_1

Jun 26th, 2017
70
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(">");scanf("%d", &temp_num);
  14.         if(temp_num>=0){score[cnt] = temp_num;cnt++;}
  15.         else if(temp_num<0) break;
  16.         else{printf("입력오류! 다시입력!.\n");printf("------\n");}
  17.     }
  18.    
  19.     for(int i= 0;i<cnt;i++)
  20.     {
  21.         print_graph(&score[i],score[i]/5);
  22.     }
  23.  
  24.     return 0;
  25. }
  26.  
  27. void print_graph(int *ps, int size)
  28. {
  29.     int mm = *ps - (*ps/10*10);
  30.     if (mm>=5){if(mm-5>2) mm=1; else mm=0;} else {if(mm>2) mm=1; else mm=0;}
  31.     int size_p = size + mm;
  32.    
  33.    
  34.     if(*ps<10)printf("(  %d) ",*ps);
  35.     else if(*ps<100)printf("( %d) ",*ps);
  36.     else printf("(%d) ",*ps);
  37.    
  38.    
  39.     for(int i=0;i<size_p;i++)
  40.     {
  41.         printf("*");
  42.         //printf("■");
  43.     }
  44.     printf("|\n");
  45. }
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.

×