Hi everyone
This is my question HELP please...
Write an algorithm to fill 6 positions in a vector, integer, values between 20 and -20, and the print on the screen. Then will be shown how many numbers read are positive values.
The output must be like this:
Insert an value between 20 and -20: -10
Insert an value between 20 and -20: 8
Insert an value between 20 and -20: 9
Insert an value between 20 and -20: 10
Insert an value between 20 and -20: 5
Insert an value between 20 and -20: 6
Inserted numbers
Inserted Value: -10
Inserted Value: 8
Inserted Value: 9
Inserted Value: 10
Inserted Value: 5
Inserted Value: 6
-> There are 5 positive values
VulpesPosted Feb 14, 2014, 7:13 AM
Guest UserPosted Feb 14, 2014, 8:05 AM
VulpesPosted Feb 14, 2014, 8:01 AM
If it can, then the method returns true and the value is assigned to the 'out' parameter.
If it can't, then the method returns false and 0 is assigned to the 'out' parameter.
So, if this method return returns false (because the user enters 'abc' say) or if it returns an int which is less than -20 or more than 20, we print an error message and ask the user to re-input the number.
It's just an easy way to validate input.
Guest UserPosted Feb 14, 2014, 7:32 AM
but can you explain this part thanks