Facebook
From c++, 4 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 166
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int o1(int a, int b){
  6.         return a + b;
  7. }
  8.  
  9. void o2(int suma){
  10.     cout<<suma;
  11. }
  12.  
  13. void o4(){
  14.     cout<<"liczba podzielna przez 2";
  15.     }
  16.  
  17. void o5(){
  18.     cout<<"Liczba nie podzielna przez 2";
  19. }
  20.  
  21. void o3(int suma){
  22.     if(suma % 2 == 0){
  23.         o4();
  24.     }
  25.     else{
  26.         o5();
  27.     }
  28. }
  29.  
  30.  
  31. void o6(int a, int b){
  32.     string imie="pawel";
  33.     for(a;a<b;a++)
  34.         cout<<imie;
  35.     }
  36.  
  37. int main()
  38. {
  39.     int a,b,suma;
  40.     cout<<"Podaj liczbe: ";
  41.     cin>>a;
  42.     cout<<"Podaj liczbe: ";
  43.     cin>>b;
  44.     suma = o1(a,b);
  45.     o2(suma);
  46.     o3(suma);
  47.     if(a < b){
  48.         o6(a,b);
  49.     }
  50.     else if(b < a){
  51.         o6(b,a);
  52.     }
  53.     return 0;
  54. }
  55.