ruchamcimatke

Main.cpp

Mar 14th, 2018
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #include <iostream>
  2. #include "BazaTestu.hh"
  3. #include "Statystyka.hh"
  4.  
  5.  
  6.  
  7.  
  8. using namespace std;
  9.  
  10.  
  11.  
  12.  
  13. int main(int argc, char **argv)
  14. {
  15.  
  16. if (argc < 2) {
  17. cout << endl;
  18. cout << " Brak opcji okreslajacej rodzaj testu." << endl;
  19. cout << " Dopuszczalne nazwy to: latwy, trudny." << endl;
  20. cout << endl;
  21. return 1;
  22. }
  23.  
  24.  
  25. BazaTestu BazaT = { nullptr, 0, 0 };
  26.  
  27. if (InicjalizujTest(&BazaT,argv[1]) == false) {
  28. cerr << " Inicjalizacja testu nie powiodla sie." << endl;
  29. return 1;
  30. }
  31.  
  32. cout << endl;
  33. cout << " Start testu arytmetyki zespolonej: " << argv[1] << endl;
  34. cout << endl;
  35.  
  36. WyrazenieZesp WyrZ_PytanieTestowe;
  37. LZespolona odp;
  38. Statystyka staty = { 0, 0 };
  39.  
  40. while (PobierzNastpnePytanie(&BazaT,&WyrZ_PytanieTestowe)) {
  41. cout << " Podaj wynik operacji: ";
  42. cout << WyrZ_PytanieTestowe.Arg1;
  43. cout << ZwrocSymbol(WyrZ_PytanieTestowe.Op);
  44. cout << WyrZ_PytanieTestowe.Arg2;
  45. cout << endl;
  46.  
  47. cout << " Twoja odpowiedz: " ;
  48. cin >> odp;
  49.  
  50. if(odp == Oblicz(WyrZ_PytanieTestowe))
  51. {
  52. cout << " Odpowiedz poprawna" << endl;
  53. staty.iloscPrawidlowychOdp++;
  54. staty.iloscWszystkichOdp++;
  55. }
  56. else
  57. {
  58. cout << " Blad. Prawidlowym wynikiem jest: "<< Oblicz(WyrZ_PytanieTestowe)<< endl;
  59. staty.iloscWszystkichOdp++;
  60. }
  61.  
  62.  
  63. cout << endl;
  64. }
  65.  
  66. cout << "Ilosc dobrych odpowiedzi: " << staty.iloscPrawidlowychOdp << endl;
  67. cout << "Ilosc blednych odpowiedzi: " << staty.iloscWszystkichOdp - staty.iloscPrawidlowychOdp << endl;
  68. cout << "Wynik procentowy poprawnych odpowiedzi: ";
  69. WyswietlProcenty(staty);
  70. cout << endl;
  71.  
  72.  
  73. cout << endl;
  74. cout << " Koniec testu" << endl;
  75. cout << endl;
  76.  
  77. }
Add Comment
Please, Sign In to add comment