I am writing a c++ program to validate input of a 3 digit number in any order. F
ID: 3654990 • Letter: I
Question
I am writing a c++ program to validate input of a 3 digit number in any order. For example 321 can be represented as
312
132
123
213
231
The program should check for all these combinations and give out a statement i.e "you have matched all the digits". I know how to validate the first and the last digit but i'm not sure how to validate the middle one. I want to do this without using arrays.
To check for the last digit you would use
if (guess==actualvalue){
cout<<"The last digits are the same ?";
}
However, I am not sure on how to validate the digit in the middle without using arrays.
Explanation / Answer
count=0; number;// It store your input number r1=number%10; number=number/10; r2=number%10; r3=number/10 if (r1==1|r1==2|r1==3){ count++; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.