If someone enteres -1

0 Adeel Salim · August 30, 2016
Hi! If someone enteres -1 is as the age of first person wouldnt this program an error like -1/0 is infinity so average age will just give wrong should'nt we put if look below while loop to check if age = -1 then it should say no average age

Post a Reply

Replies

Oldest  Newest  Rating
0 Gebran AL-maarry · September 2, 2016
if you print -1 to the program it will return the avreage as -1 /images/forum/upload/2016-09-01/b6c9731c31ac5f207ae4e90e62bd003e.PNG
0 pwntastic _ · September 3, 2016
I don't know much about the app you're referring to but instead of just checking for -1 as an age, it sounds like you should be checking for any negative number or maybe converting the age entered to an absolute value.
0 Adeel Salim · September 3, 2016
Gebran Al-maary in your program enter the first number -2
and try  
  • 1

C++

131,250 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator