Advertisement
dzieciol

zadanie 1a

Oct 20th, 2016
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /*
  8.  * File:   main.cpp
  9.  * Author: Tomek
  10.  *
  11.  * Created on 20 października 2016, 18:03
  12.  */
  13.  
  14. #include <cstdlib>
  15. #include <iostream>
  16.  
  17. using namespace std;
  18.  
  19. class ulamek
  20. {
  21.     int licznik, mianownik;
  22.    
  23. public:
  24.     ulamek(int,int) ;
  25.     ulamek();
  26.     wyswietl();
  27.    
  28. };
  29.  
  30. /*
  31.  *
  32.  */
  33. int main(int argc, char** argv) {
  34.    
  35.     ulamek u1;
  36.     ulamek u2(1,4);
  37.     u1.wyswietl();
  38.     u2.wyswietl();
  39.  
  40.     return 0;
  41. }
  42. ulamek::ulamek(int l, int m){
  43.     licznik = l;
  44.     mianownik = m;
  45. }
  46.  
  47. ulamek::ulamek(){
  48.     licznik = 1;
  49.     mianownik = 1;
  50. }
  51.  
  52. ulamek::wyswietl()
  53. {
  54.     cout<<licznik<<"/"<<mianownik<<endl;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement