Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- short rb2=0,rb3=0,rb4=0,rb5=0,i=0;
- char rb0,rb1;
- while (1)
- {
- cout<<"Pritisni taster '-', '0' ili '+': " << endl;
- cin>>rb0;
- cin>>rb1;
- if (rb0=='0'&&rb1=='+')
- i++;
- else if(rb0=='-'&&rb1=='0')
- i--;
- else
- break;
- if (i<=0)
- {
- i=0;
- rb2=0;
- rb3=0;
- rb4=0;
- rb5=0;
- cout<<rb2<<rb3<<rb4<<rb5<<endl;
- }
- if (i>=4)
- {
- i=4;
- rb2=1;
- rb3=1;
- rb4=1;
- rb5=1;
- cout<<rb2<<rb3<<rb4<<rb5<<endl;
- }
- if (i==1)
- {
- rb2=1;
- rb3=0;
- rb4=0;
- rb5=0;
- cout<<rb2<<rb3<<rb4<<rb5<<endl;
- }
- if (i==2)
- {
- rb2=1;
- rb3=1;
- rb4=0;
- rb5=0;
- cout<<rb2<<rb3<<rb4<<rb5<<endl;
- }
- if (i==3)
- {
- rb2=1;
- rb3=1;
- rb4=1;
- rb5=0;
- cout<<rb2<<rb3<<rb4<<rb5<<endl;
- }
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement