fork download
  1. #include <iostream>
  2. #include <string>
  3. #include<stdio.h>
  4. #include<cstdlib>
  5. #include <bitset>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. string ain;
  11. string pain;
  12. int a = 55, b= 15;
  13. int c = a & b;
  14. int d = a | b;
  15. bool aerzo = !b;
  16. getline(cin,ain);
  17. cout << ain+" is your name?\n";
  18. getline(cin,pain);
  19. cout << pain+" is your favorite food?\n\n";
  20.  
  21. if (a>b)
  22. cout << "a("+to_string(a)+") is greater than b("+to_string(b)+")";
  23. else
  24. if (a<b)
  25. cout << "a("+to_string(a)+") is less than b("+to_string(b)+")";
  26. else
  27. cout << "a("+to_string(a)+") and b("+to_string(b)+") are equal";
  28.  
  29. cout << endl << aerzo;
  30.  
  31. cout << "\na in 8bit binary: " << bitset <8> (a) << "\nb in 8bit binary: " << bitset <8> (b);
  32.  
  33. cout << "\na & b: " << c << " or " <<bitset <8> (c);
  34. cout << "\na | b: " << d << " or " <<bitset <8> (d);
  35.  
  36. system("pause");
  37. return 0;
  38. }
Success #stdin #stdout #stderr 0s 5324KB
stdin
Sikren
Pizza
stdout
Sikren is your name?
Pizza is your favorite food?

a(55) is greater than b(15)
0
a in 8bit binary: 00110111
b in 8bit binary: 00001111
a & b: 7 or 00000111
a | b: 63 or 00111111
stderr
sh: 1: pause: not found