Hello you more experienced C++ programmers,
I am learning C++ on my own (just to keep my brain cells active); bought the C++ Programming book, and so far have been doing pretty good. The book has an exercise which I am now struggling: the program should prompt user to enter a length in feet and inches for 10 times, and display the sum of all user inputs as feet and inches. Additionally, the program should display the lowest and highest value of user inputs. I am struggling with the lowest and highest part. Code below shows how I have started the exercise, but I am not sure if I, instead of the for loop, should have used variables
int userFeet1, userInches1, userFeet2, userInches2 etc. until userFeet10, userInches10 so that I can find the lowest and highest values. Any advice?
using namespace std;
int sumInches =0;
int feet, inches;
int lowest_value, highest_value = 0:
for(int i=1;i<=10; i++) //loop ten times
cout<<"Enter the lenght in feet and inches: ";
int length= feet*12 + inches; //convert to inches
sumInches = sumInches + length;//calculate total inches
feet = sumInches/12;
inches %= 12;
cout <<"The sum is " << feet << " feet " << inches << " inches " <<endl; //print the sum of users inputs in feet and inches
//code for highest and lowest value........