|
| b33p (4) | |
| Hi guys, I am suppose to write a code to make sure the users input is between 0 and 4000 and also a multiple of 100. How do i do the mulitple of 100 part? So far i have this.. [code] cin >> store1; while ( store1 < 0 || store2 > 4000) { cout << "Invalid entry"; } [\code] | |
| kempofighter (672) | |
| One word: modulo (%). Also, what is store2? | |
| b33p (4) | |||
| oh sorry it was a typo i meant store1 and also yeah but i dont know how to combine the modulus into my code i tired this and it didnt work
| |||
| Bazzy (4120) | |
| The != should be == | |
| b33p (4) | |
| no it can't be == because my code is saying if the input for store1 is not between 0-4000 or is not a multiple of 100 then an error message will be displayed. | |
| helios (6080) | |
| (a && b || c) is the same as ((a && b) || c), not (a && (b || c)). | |
This topic is archived - New replies not allowed.
