### Limited The Code <?>

 ``1234567891011121314151617181920212223242526272829303132333435363738`` ``````#include #include void main() { int i,j,smalltest,temp; int Array[8]; cout<<"Put A Value !"<>Array[a]; } cout<<"Value Before Sorted:\n\n"; for(int k=0;k<=7;k++) { cout<Array[j]) { smalltest=j; } } temp=Array[i]; Array[i]=Array[smalltest]; Array[smalltest]=temp; } cout<<"\n\nValue After Sorted:\n\n"; for(int l=0;l<=7;l++) { cout<

hi guys,the code above needs to be limited,how to make it "When we put the number larger than 99,the exe will close,or show some text : YOU PUT WRONG VALUE!",how?? tq :)
 ``89101112`` `````` for (int a=0; a<=7; a++) { cout<<"Value "<>Array[a]; }``````

It's in this block that you're asking for input, so it would make sense to put the validation here.

The easiest way is probably:

* make temporary int
* cin >> temp_int
* if tmp_int is larger than 99, decrease the counter (a) by 1 and continue to the next iteration
* else, set Array[a] = temp_int

That should provide you all the info you need to get that sorted.
Please do let us know if you require any further help.

All the best,
NwN
@NwN please put in one @code so all done,this is my assignment for 1 week :)
 @NwN please put in one @code so all done,this is my assignment for 1 week :)

That's your job. We're not here to do your homework for you. We'll give advice on C++ issues, and we'll take a look at code to see where problems are. We're not going to write it for you.
Topic archived. No new replies allowed.