Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.09 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <stdio.h>
  4. #include <cstdlib>
  5. #include <conio.h>
  6. #include <limits>
  7. using namespace std;
  8.  
  9.  
  10.  
  11. void kalkulator()
  12. {
  13.  
  14.  
  15. }
  16. void kalkulator_BMI()
  17. {
  18.     float waga;
  19.     double wzrost, bmi;
  20.     cout << "Prosze, podaj swoja wage." << endl;
  21.     cin >> waga; cout << endl;
  22.     cout << "Prosze, podaj swoj wzrost." << endl;
  23.     cin >> wzrost; cout << endl;
  24.     bmi = waga / (wzrost * wzrost);
  25.     cout << "Twoje bmi wynosi: " << bmi << endl;
  26.     cout << "Komentarz odnosnie twojej wagi: " << endl;
  27.     if (bmi <= 18.5)
  28.         cout << "Masz niedowagę" << endl;
  29.     if (bmi > 18.5 && bmi <= 23)
  30.         cout << "Wszystko jest z tobą wporządku :)" << endl;
  31.     if (bmi > 23 && bmi <= 25)
  32.         cout << "Masz nadwagę" << endl;
  33. }
  34. void gra_zgadnij_liczbe()
  35. {
  36.  
  37.  
  38. }
  39.  
  40.  
  41. int main()
  42. {
  43.     int wybor = -1;
  44.     while (wybor != 4)
  45.     {
  46.  
  47.         cout << "******MENU APLIKACJI******" << endl;
  48.         cout << "------------------------" << endl;
  49.         cout << "1. Kalkulator" << endl;
  50.         cout << "2. Kalkulator BIM" << endl;
  51.         cout << "3. Gra zgadnij liczbe" << endl;
  52.         cout << "4. Zamkniecie Aplikacji" << endl;
  53.         cout << "------------------------" << endl;
  54.  
  55.    
  56.         switch (wybor)
  57.         {
  58.         case 1:
  59.             kalkulator();
  60.             break;
  61.         case 2:
  62.             kalkulator_BMI();
  63.  
  64.             break;
  65.         case 3:
  66.             gra_zgadnij_liczbe();
  67.  
  68.             break;
  69.         case 4:
  70.             exit(0);
  71.             break;
  72.         default:
  73.             cout << "Nie ma takiej opcji w menu!" << endl;
  74.             break;
  75.  
  76.         }
  77.  
  78.         while (wybor <= 0 || wybor > 4) {
  79.             cout << "Wybierz funkcje aplikacji: ";
  80.             cin >> wybor;
  81.             while (cin.fail())
  82.             {
  83.             cout << "Wybor: ";
  84.                 cin.clear();
  85.                 cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
  86.                 cin >> wybor;
  87.            
  88.             }
  89.         };
  90.    
  91.        
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.         return (0);
  101.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement