Advertisement
lukii1231

zadanie c++ 21.02 do..while/if/void

Feb 21st, 2020
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void Podzielna();
  5. void Min3();
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12. int main() {
  13.  
  14.  
  15. cout<<"Jesli chcesz zakonczyc program wcinij x"<<endl<<endl;
  16. do{
  17. Podzielna();
  18. Min3();
  19.  
  20. } while(getchar()=='x' );
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. return 0;
  34. }
  35.  
  36. void Podzielna()
  37. {
  38. int a,b;
  39. cout<<"podaj 2 liczby: ";
  40. cin>>a>>b;
  41.  
  42.  
  43. if(a%b!=0)
  44. cout<<"Liczba "<<a<<" nie jest podzielna przez "<< b << endl<< endl;
  45. else
  46. cout<<"Liczba "<<a<<" jest podzielna przez "<< b << endl << endl;
  47.  
  48.  
  49. }
  50.  
  51.  
  52. void Min3()
  53. {
  54. int x,y,z;
  55. cout<<"Podaj 3 liczby: ";
  56. cin>>x>>y>>z;
  57.  
  58. if(x<y)
  59.  
  60. {
  61. if(x<=z)
  62.  
  63. cout<<"Liczba "<< x <<" jest mniejsza lub rowna "<< z <<endl;
  64.  
  65. }
  66.  
  67. if(y<=z)
  68.  
  69.  
  70. cout<<"Liczba "<< y <<" jest mniejsza lub rowna "<< z <<endl;
  71.  
  72. else
  73. cout<<"Liczba "<< z <<" jest mniejsza lub rowna "<< y <<endl;
  74.  
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement