Facebook
From Whipped Wigeon, 7 Years ago, written in C++.
">

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type bool

Filename: view/view.php

Line Number: 33

from

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type bool

Filename: view/view.php

Line Number: 33

- view diff
Embed
Download Paste or View Raw
Hits: 361
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <limits>
  4. #include <bitset>
  5. using namespace std;
  6.  
  7. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  8.  
  9. int main(int argc, char** argv) {
  10.        
  11.         long bin, dec = 0, rem, num, base = 1;
  12.         float a;
  13.         float b;
  14.         int wybor;
  15.        
  16.         do
  17.         {
  18.                 cout <<"======= Logic Master ======" << endl;
  19.                 cout <<"Co chcesz zrobic?" << endl;
  20.                 cout <<"[1] Tabele prawdy dla bramek" << endl;
  21.                 cout <<"[2] Kalkulator" << endl;
  22.                 cout <<"[3] Przelicznik <--- ALPHA!" << endl;
  23.                 cout <<"[4] Koniec" << endl;
  24.                 cout <<"===== created by Czarek ===" << endl;
  25.                 cin >> wybor;
  26.                 cin.clear();
  27.                 cin.sync();
  28.                
  29.                 switch(wybor)
  30.                 {
  31.                         case 1:
  32.                                 do
  33.                                 {
  34.                
  35.                 cout <<"======= Logic Master ======" << endl;
  36.                 cout <<"Co chcesz zrobic?" << endl;
  37.                 cout <<"[1] T. prawdy dla AND" << endl;
  38.                 cout <<"[2] T. prawdy dla NAND" << endl;
  39.                 cout <<"[3] T. prawdy dla OR" << endl;
  40.                 cout <<"[4] T. prawdy dla NOR" << endl;
  41.                 cout <<"[5] T. prawdy dla EXOR" << endl;
  42.                 cout <<"[6] T. prawdy dla NOT" << endl;
  43.                 cout <<"[7] Cofnij" << endl;
  44.                 cout <<"===== created by Czarek ===" << endl;
  45.                 cin >> wybor;
  46.                 cin.clear();
  47.                 cin.sync();
  48.                
  49.                 switch(wybor)
  50.         {
  51.                 case 1:
  52.                         system("cls");
  53.                         cout <<"AND" << endl;
  54.                         cout <<"a | b | y" << endl;
  55.                         cout <<"0 | 0 | 0" << endl;
  56.                         cout <<"0 | 1 | 0" << endl;
  57.                         cout <<"1 | 0 | 0" << endl;
  58.                         cout <<"1 | 1 | 1" << endl;
  59.                         break;
  60.                 case 2:
  61.                         system("cls");
  62.                         cout <<"NAND" << endl;
  63.                         cout <<"a | b | y" << endl;
  64.                         cout <<"0 | 0 | 1" << endl;
  65.                         cout <<"0 | 1 | 1" << endl;
  66.                         cout <<"1 | 0 | 1" << endl;
  67.                         cout <<"1 | 1 | 0" << endl;
  68.                         break;
  69.                 case 3:
  70.                         system("cls");
  71.                         cout <<"OR" << endl;
  72.                         cout <<"a | b | y" << endl;
  73.                         cout <<"0 | 0 | 0" << endl;
  74.                         cout <<"0 | 1 | 1" << endl;
  75.                         cout <<"1 | 0 | 1" << endl;
  76.                         cout <<"1 | 1 | 1" << endl;
  77.                         break;
  78.                 case 4:
  79.                         system("cls");
  80.                         cout <<"NOR" << endl;
  81.                         cout <<"a | b | y" << endl;
  82.                         cout <<"0 | 0 | 1" << endl;
  83.                         cout <<"0 | 1 | 0" << endl;
  84.                         cout <<"1 | 0 | 0" << endl;
  85.                         cout <<"1 | 1 | 0" << endl;
  86.                         break;
  87.                 case 5:
  88.                         system("cls");
  89.                         cout <<"EXOR" << endl;
  90.                         cout <<"a | b | y" << endl;
  91.                         cout <<"0 | 0 | 0" << endl;
  92.                         cout <<"0 | 1 | 1" << endl;
  93.                         cout <<"1 | 0 | 1" << endl;
  94.                         cout <<"1 | 1 | 0" << endl;
  95.                         break;
  96.                 case 6:
  97.                         system("cls");
  98.                         cout <<"NOT" << endl;
  99.                         cout <<"a | y" << endl;
  100.                         cout <<"0 | 1" << endl;
  101.                         cout <<"1 | 0" << endl;
  102.                         break;
  103.                 default:
  104.                         system("cls");
  105.                         cout << "Podaj LICZBE od 1 do 7" << endl;      
  106.         }
  107.                         }while(wybor != 7);
  108.                         break;
  109.  
  110.                 case 2:
  111.                         do
  112.                         {
  113.                                
  114.                                 cout <<"======= Logic Master ======" << endl;
  115.                                 cout <<"Co chcesz zrobic?" << endl;
  116.                                 cout <<"[1] Dodawanie" << endl;
  117.                                 cout <<"[2] Odejmowanie" << endl;
  118.                                 cout <<"[3] Mnozenie" << endl;
  119.                                 cout <<"[4] Dzielenie" << endl;
  120.                                 cout <<"[5] Potegowanie" << endl;
  121.                                 cout <<"[6] Cofnij" << endl;
  122.                                 cout <<"===== created by Czarek ===" << endl;
  123.                                 cin >> wybor;
  124.                                 cin.clear();
  125.                                 cin.sync();
  126.                                
  127.                                 switch(wybor)
  128.                                 {
  129.                                         case 1:
  130.                                                 cout <<"Podaj liczbe a: " << endl;
  131.                                                 cin >> a;
  132.                                                 cout <<"Podaj liczbe b: " << endl;
  133.                                                 cin >> b;
  134.                                                 system("cls");
  135.                                                 cout << "Wynik to: " << a + b << endl;
  136.                                                 cin.clear();
  137.                                                 cin.sync();
  138.                                                 break;
  139.                                         case 2:
  140.                                                 cout <<"Podaj liczbe a: " << endl;
  141.                                                 cin >> a;
  142.                                                 cout <<"Podaj liczbe b: " << endl;
  143.                                                 cin >> b;
  144.                                                 system("cls");
  145.                                                 cout << "Wynik to: " << a - b << endl;
  146.                                                 cin.clear();
  147.                                                 cin.sync();
  148.                                                 break;
  149.                                         case 3:
  150.                                                 cout <<"Podaj liczbe a: " << endl;
  151.                                                 cin >> a;
  152.                                                 cout <<"Podaj liczbe b: " << endl;
  153.                                                 cin >> b;
  154.                                                 system("cls");
  155.                                                 cout << "Wynik to: " << a * b << endl;
  156.                                                 cin.clear();
  157.                                                 cin.sync();
  158.                                                 break;
  159.                                         case 4:
  160.                                                 cout <<"Podaj liczbe a: " << endl;
  161.                                                 cin >> a;
  162.                                                 cout <<"Podaj liczbe b: " << endl;
  163.                                                 cin >> b;
  164.                                                 if(b != 0)
  165.                                                 {
  166.                                                 system("cls"); 
  167.                                                 cout << "Wynik to: " << a / b << endl;
  168.                                                 break;
  169.                                                 }
  170.                                                 else
  171.                                                 {
  172.                                                         system("cls");
  173.                                                         cout << "Nie dziel przez 0!" << endl;
  174.                                                 }
  175.                                                 break;
  176.                                         case 5:
  177.                                                 cout <<"Podaj liczbe a: " << endl;
  178.                                                 cin >> a;
  179.                                                 system("cls");
  180.                                                 cout <<"Wynik to: " << a*a << endl;
  181.                                                 cin.clear();
  182.                                                 cin.sync();
  183.                                                 break;
  184.                                         default:
  185.                                                 system("cls");
  186.                                                 cout << "Zrobiles cos nie tak ;(" << endl;
  187.                                                 cin.clear();
  188.                                                 cin.sync();
  189.                                                 break;
  190.                                 }
  191.                                        
  192.                         }while(wybor != 6);
  193.                         case 3:
  194.                                 do
  195.                                 {
  196.                                         cout <<"======= Logic Master ======" << endl;
  197.                                         cout <<"Co chcesz zrobic?" << endl;
  198.                                         cout <<"[1] BIN -> DEC" << endl;
  199.                                         cout <<"[2] DEC -> BIN" << endl;
  200.                                         cout <<"[3] DEC -> HEX" << endl;
  201.                                         cout <<"[4] HEX -> DEC" << endl;
  202.                                         cout <<"[5] BIN -> HEX" << endl;
  203.                                         cout <<"[6] HEX -> BIN" << endl;
  204.                                         cout <<"[7] Cofnij" << endl;
  205.                                         cout <<"===== created by Czarek ===" << endl;
  206.                                         cin >> wybor;
  207.                                         cin.clear();
  208.                                         cin.sync();
  209.                                        
  210.                                         switch(wybor)
  211.                                         {
  212.                                                 case 1:
  213.                                                         cout << "Wprowadz liczbe w systemie binarnym: " << endl;
  214.                                                         cin.clear();
  215.                                                         cin.sync();
  216.                                                         cin >> num;
  217.                                                         bin = num;
  218.                                                         while (num > 0)
  219.                                                         {
  220.                                                                 rem = num % 10;
  221.                                                                 dec = dec + rem * base;
  222.                                                                 base = base * 2;
  223.                                                                 num = num / 10;
  224.                                                         }
  225.                                                         system("cls");
  226.                                                         cout << bin << "w systemie dziesiatkowym to: " << dec << endl;
  227.                                                         break;
  228.                                                 case 2:
  229.                                                        
  230.                                                        
  231.                                                        
  232.                                                 default:
  233.                                                         system("cls");
  234.                                                         cout << "Zrobiles cos nie tak!" << endl;
  235.                                                         break;
  236.                                                
  237.                                                        
  238.                                                        
  239.                                         }
  240.                                        
  241.                                        
  242.                                 }while(wybor != 7);
  243.        
  244.                 }
  245.                
  246.                 }while(wybor != 4);
  247.        
  248.         return 0;
  249. }