Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. void ch04q12()
  2. {
  3. const int SIZE = 4 ;
  4.  
  5. int num[SIZE] ;
  6. int max = 0 ;
  7. int i , k , j ;
  8.  
  9. cout << "Please insert 4 numbers using space --> " ;
  10. for(i=0;i<SIZE;i++)
  11. {
  12. cin >> num[i] ;
  13.  
  14. if(num[i]>max)
  15. max = num[i] ;
  16. }
  17.  
  18. cout << endl ;
  19.  
  20. for(i=0;i<SIZE+8;i++)
  21. cout << "-" ;
  22.  
  23. cout << endl ;
  24.  
  25. k = max ;
  26.  
  27. for(i=0;i<max;i++)
  28. {
  29. for(j=0;j<SIZE;j++)
  30. {
  31. if(num[j] >= k )
  32. {
  33. cout << "*" ;
  34. }
  35. else
  36. cout << " " ;
  37.  
  38. cout << " " ;
  39. }
  40.  
  41. k-- ;
  42.  
  43. cout << endl ; // Hight
  44. }
  45.  
  46. for(i=0;i<SIZE+8;i++)
  47. cout << "-" ;
  48.  
  49. cout << endl ;
  50.  
  51. for(i=0;i<SIZE;i++)
  52. cout << num[i] << " " ;
  53.  
  54. cout << endl << endl ;
  55.  
  56. system("pause") ;
  57. system("cls") ;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement