How do i receive an integer and return true if is greater than or equal to zero; or false otherwise? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i receive an integer and return true if is greater than or equal to zero; or false otherwise?

the fuction is esPostivo()

21st Sep 2018, 12:58 PM
OlVeRaS94HD
OlVeRaS94HD - avatar
2 Answers
+ 1
OlVeRaS94HD bool esPostivo(int num) { if(num >= 0) { return true; } else { return false; } }
21st Sep 2018, 1:36 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
int num; cin >> num; if(num >= 0){ return true; }else{ return false }
21st Sep 2018, 1:31 PM
Ramphy Aquino Nova
Ramphy Aquino Nova - avatar