0

What the functions can I used? if inside the loop didn't find the correct number?

Example I have loop the is running I want is the inside of int number didn't find the number when the user type wrong number it show messages said it the number you entered is invalid. int number=10; int itemcode[number]; for(int i=0;i<number;i++){ cout <<"ENTER NUMBER (TYPE F TO FINISH)"<<endl; cin >>itemcode[number]; // i am stuck on this how do i do?// }

20th Nov 2019, 12:40 PM
Shofi Uddin
5 Answers
0
Shofi Uddin Again you are asking to input a character in an array containing integers.
20th Nov 2019, 1:22 PM
Avinesh
Avinesh - avatar
0
So I have to ask outside of array functions
20th Nov 2019, 1:31 PM
Shofi Uddin
0
You asking for input F in loop to exit loop. Is it? If yes then where are you checking that to exit...? And why you to need input F which is a character, not an integer. You are using for loop, so after 10 inputs it will exit as for your code. Do you need only less than 10 inputs? if not then Don't check for f input and Change itemcode[number] to itemcode[i] if you need different numbers to save...
20th Nov 2019, 2:04 PM
Jayakrishna 🇼🇳
0
I just is in loop if u put 3 input the user can enter f to exit or continue until infinite
20th Nov 2019, 2:08 PM
Shofi Uddin
0
Shofi Uddin They are telling you same thing dude...you declared an array of integer then how can you insert a character value?? Just tell us what program you want to make??Then may be we can help you.. For eg. If you don't want negative numbers to be inserted, then check the number everytime if it is <0.. Or if you want to terminate program whenever user wants, like you said then write “Enter negative value to exit" rather than Press F..
22nd Nov 2019, 1:38 PM
Alaska
Alaska - avatar