Hi! I'm making a C++ program which requires the user to input only binary digits (0,1) indefinitely until the user input 1's and 0's in a sequence of
1
0
1
0
1
Problem: Now the problem I'm facing is that previously i have made a program that runs until the user gives a valid input but in this case I don't understand how can I specify this sequence for program to end. I planned of using if(true) and (false) in a while(true) loop. but while I couldn't implement it.
exact question for the code:
Write a C++ program that will indefinitely take a binary input of 0 or 1. However, upon receiving a special code pattern of 10101, the program will stop the input, output “Input Terminated”, and then the
program will terminate.
sample output: