garryhtreez

5.11

Nov 13th, 2020 (edited)
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. /* 5.11 Find the Smallest Value
  2.    Deitel & Deitel C++ How to Program, 10th ed (Indian sub continent edition)
  3.    Visual Studio Community 2019 */
  4.  
  5. #include <limits>
  6. #include <iostream>
  7.  
  8. using namespace std;
  9.  
  10. int main(void) {
  11.     int foundMin = INT_MAX;
  12.     cout << "Enter the number of integers you will be entering: ";
  13.     int numberOfInts{ 0 }, count{ 0 }, num{ 0 };
  14.     cin >> numberOfInts;
  15.     while (count < numberOfInts) {
  16.         cout << "#"<< count + 1 << " Enter an integer and hit <Enter> ";
  17.         cin >> num;
  18.         if (num < foundMin) foundMin = num;
  19.         count++;
  20.     }
  21.     cout << "The smallest integer is " << foundMin;
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment