Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. short rb2=0,rb3=0,rb4=0,rb5=0,i=0;
  8. char rb0,rb1;
  9. while (1)
  10. {
  11. cout<<"Pritisni taster '-', '0' ili '+': " << endl;
  12. cin>>rb0;
  13. cin>>rb1;
  14. if (rb0=='0'&&rb1=='+')
  15. i++;
  16. else if(rb0=='-'&&rb1=='0')
  17. i--;
  18. else
  19. break;
  20.  
  21. if (i<=0)
  22. {
  23. i=0;
  24. rb2=0;
  25. rb3=0;
  26. rb4=0;
  27. rb5=0;
  28. cout<<rb2<<rb3<<rb4<<rb5<<endl;
  29. }
  30. if (i>=4)
  31. {
  32. i=4;
  33. rb2=1;
  34. rb3=1;
  35. rb4=1;
  36. rb5=1;
  37. cout<<rb2<<rb3<<rb4<<rb5<<endl;
  38. }
  39. if (i==1)
  40. {
  41. rb2=1;
  42. rb3=0;
  43. rb4=0;
  44. rb5=0;
  45. cout<<rb2<<rb3<<rb4<<rb5<<endl;
  46. }
  47. if (i==2)
  48. {
  49. rb2=1;
  50. rb3=1;
  51. rb4=0;
  52. rb5=0;
  53. cout<<rb2<<rb3<<rb4<<rb5<<endl;
  54. }
  55. if (i==3)
  56. {
  57. rb2=1;
  58. rb3=1;
  59. rb4=1;
  60. rb5=0;
  61. cout<<rb2<<rb3<<rb4<<rb5<<endl;
  62. }
  63. }
  64. system("pause");
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement