0

Part(2) Having trouble at the output in C++ while loop with arrays

I have found a better solution for my last problem that doesn't include arrays but this new solution seems to have a problem on its own as well when i input big numbers like -40 0 5 -85 90. Please help point out my mistakes https://code.sololearn.com/cIQp7HQk7gDW/?ref=app https://www.sololearn.com/discuss/2729549/?ref=app

19th Mar 2021, 6:18 AM
Jessica Zarate
Jessica Zarate - avatar
13 Respuestas
+ 2
Martin Taylor I can't show how much gratitude I have. I'll learn everything inside this code of yours. Reaally reaally thank youu🤧🤧💕
19th Mar 2021, 3:03 PM
Jessica Zarate
Jessica Zarate - avatar
+ 2
// Hi, this is one propose #include <iostream> using namespace std; int main() { int count = 0, small, n; cout<<"This program only limited to 5 entries\nEnter first number: "; cin>> small; //syntax for while loop while(true) { cin>>n; if(n<small) small = n; if(++count == 5) break; } //finding the smallest value cout<<"\nThe smallest value is:"<<small<<endl; return 0; }
20th Mar 2021, 12:16 AM
Ruben Enrique
Ruben Enrique - avatar
+ 1
Hello thank for the help. I have finally made a better code.
19th Mar 2021, 1:17 PM
Jessica Zarate
Jessica Zarate - avatar
+ 1
Coder Kitten Thank you for pointing this out. If only i can just enter positive numbers and not negatives I wouldn't have to wrack my brain out. I guess this is too advance for me
19th Mar 2021, 2:59 PM
Jessica Zarate
Jessica Zarate - avatar
+ 1
Thank you Ruben Enrique. This is my first time encountering while (true) it's very simple and easy to understand. Thank you for helping me!
20th Mar 2021, 6:57 AM
Jessica Zarate
Jessica Zarate - avatar
19th Mar 2021, 1:21 PM
Jessica Zarate
Jessica Zarate - avatar
0
It's taking everything I have to answer this. So I'm always happy when I somehow improve.
19th Mar 2021, 2:50 PM
Jessica Zarate
Jessica Zarate - avatar
0
It's still didn't worrrrkkkkk
19th Mar 2021, 2:57 PM
Jessica Zarate
Jessica Zarate - avatar
20th Mar 2021, 2:18 PM
TeaserCode