0

Pushing Values (First In, First Out)

How can you push a value to the next place when a new value is entered? Is there another way? This is my program: < START > #include<iostream.h> #include<conio.h> #include<stdlib.h> void main(){ clrscr(); int dDigit01 = 0; int dDigit02 = 0; int dDigit03 = 0; int dDigit04 = 0; char choice; OVERAGAIN: cout << "Ă‰ĂĂĂĂ‹ĂĂĂĂ‹ĂĂĂĂ‹ĂĂĂÂ»\n"; cout << "Âș Âș Âș Âș Âș\n"; cout << "ĂˆĂĂĂĂŠĂĂĂĂŠĂĂĂĂŠĂĂĂÂŒ\n"; gotoxy(3,2); dDigit01 = getche(); gotoxy(3,2); dDigit02 = getche(); gotoxy(7,2); cout << dDigit01; gotoxy(3,2); dDigit02 = getche(); gotoxy(7,2); cout << dDigit01; gotoxy(11,2); cout << dDigit02; gotoxy(3,2); dDigit02 = getche(); gotoxy(7,2); cout << dDigit01; gotoxy(11,2); cout << dDigit02; gotoxy(15,2); cout << dDigit03; cout << "\n\nDo you want to try again to insert numbers; 1 or 0."; cout << "[A] - Start Again | [B] Exit\n"; choice = getche(); switch (choice) { case 'A' | 'a': clrscr(); goto OVERAGAIN; case 'B' | 'b': exit(0); } getch(); } < END > So all I wanted is when I enter 1201, it will represent 1021.

17th Jan 2018, 1:58 AM
Joseph Adrian Padriga
Joseph Adrian Padriga - avatar
1 Answer
+ 2
As far as I could understand, you want to reverse the number 1201 to 1021. Is that correct? Now, do you want to implement a queue for this? Or all you have to do is reverse a standard int number? Or perhaps you want to type the numbers right to left? Eg - 1 0 2 1 // This was the screen when you // typed 1021. Ill help but I am unable to understand what you need to do here. I think the last one is what you want, as you used cursor placing functions.
17th Jan 2018, 9:05 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar