Hi there, i am a c++ newbie.I was asked to write a function that takes in 3 integer parameters and returns two smallest integers among them.
Here is what i done so far...though there is 2 error C2143 which i really dun noe whats wrong T_T.
Please tell me i am on the right track and why there is a error...
And any hints or good websites on how to find the second smallest number would be greatly appreciated.
firedraco was asking for the error message (for example "expected ; before ,"), not the error code (C2143). Never post the error code by itself. It's very unlikely anyone will be able to figure out the error message from it. However, including the error code along with the error message makes it easier for search engines.
Why don't you just sort the array? it is so small it'll be super fast and then the first two numbers will be the two smallest. std::sort will do the trick. std::sort(num, num + 3);
After that, elements 0,1 are the smallest, next smallest numbers respectively.