Validation for multiplying value at C++? -


i have make test number has multiple of 500,

      do{             cout << "input price[price>0|price multiple of 500]: ";             cin >> price;             cin.sync(); cin.clear();         } while (price<1 || price>5000); 

the code still incomplete, have add following validation left. do?

and right term kind of validation? had hard time determining title.

add following test :

price % 500 == 0 

this commonly called modulo (finds remainder of division between 2 numbers) : if price multiple of 500, remainder of division between price , 500 0.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -