Advertisement
Guest User

Untitled

a guest
Nov 11th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string>
  6. #include <time.h>
  7. #include <windows.h>
  8. #include <conio.h>
  9. #include "parzyste.h"
  10.  
  11. using namespace std;
  12.  
  13. Parzyste::Parzyste(int nn, int ll_parzystych)
  14. {
  15.     n = nn;
  16.     l_parzystych = ll_parzystych;
  17. }
  18. Parzyste::~Parzyste()
  19. {
  20.     cout<<endl<<"Trwa wylaczanie wszystkiego...";
  21. }
  22. void Parzyste::pWyciagnijIlosc()
  23. {
  24.     cout<<"Ile liczb ma sie pojawic: ";
  25.     cin >> n;
  26. }
  27.  
  28. void Parzyste::pObliczIlosc()
  29. {
  30.     for(int i=0;i<n;i++)
  31.     {
  32.         int liczba; //wczytujemy liczbe
  33.         cin >> liczba;
  34.  
  35.         if(liczba % 2 == 0) //sprawdzamy czy parzysta
  36.         {
  37.             l_parzystych++;
  38.         }
  39.     }
  40. }
  41.  
  42. void Parzyste::pPokazIlosc()
  43. {
  44.     cout<<"Parzyste: "<<l_parzystych<<endl;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement