By using this site, you agree to our Privacy Policy and our Terms of Use. Close

Here's a basic code sample where it reads in 10 numbers typed on the console line. btw, Google needs to become your best friend as a developer otherwise you'll fail.

EDIT: I took original from google without reading if fully. Not sure if it worked.. I have written my own simplifed version after actually looking at other.

  • int max, min, num;
  •  
  • cout << "Enter number 1: ";
  • cin >> num;
  • max = num;
  • min = num;
  •  
  • for (int i = 1; i < 5; i"plusplus" ) {
  •    cout << "Enter number " << i   1 << ": ";
  •    cin >> num;
  •    //Check if num > max
  •    //Check if num < min
  • }
  • // max and min are now the largest/smallest values entered so post out answers
  • Haven't touched C"plusplus" in years so hopefully this gets you started and just fill in my commented areas.