0

Please. How can i write the syntax of a function in c++ that has an integer as paramaters and that returns a boolean..

the function returns a boolean true if the parameter can only be divided by two numbers. and false if it can be divided by more than two or less than two numbers.

30th Sep 2017, 12:04 AM
love
love - avatar
4 odpowiedzi
0
the problem is my code.. i am not getting what i'm excepecting https://code.sololearn.com/cAV8S6GsbSSs/?ref=app
30th Sep 2017, 1:10 AM
love
love - avatar
0
i think it's OK now... Thanks for all your support. https://code.sololearn.com/cAV8S6GsbSSs/?ref=app
30th Sep 2017, 7:44 AM
love
love - avatar
- 1
Your function will always return false as you go past the point where the true statement happens. Maybe put a break statement in there exiting the loop as you detect true. However, you might be better off returning the matching number or -1 so you can do something with it say outputting the value that was found.
30th Sep 2017, 2:37 AM
John Wells
John Wells - avatar