Hey guys I need help finding the smallest and biggest number. All of the numbers are in one file. Then I need to create a file to output the result.
There are 7 different numbers to analyze that the program reads. I just can't seem to get the biggest number or the smallest. Also I cant use an array (teacher said). I asked my classmates and told me to use this:
for (int i=0;i<7;i++)
^ but I dont know where to go from there..
Thank you in advance!
while (thefile>>num1>>num2>>num3>>num4>>num5>>num6>>num7){
total = num1+num2+num3+num4+num5+num6+num7;
average=total/7;
for (int i=0;i<7;i++)
thefile2<<num1<<"\t"<<num2<<"\t"<<num3<<"\t"<<num4<<"\t"<<num5<<"\t"<<num6<<"\t"<<num7<<":"<<endl;
cout<<endl;
thefile2<<"The total for the line above is: "<<total<<endl;
thefile2<<"The average for the line above is: "<<average<<endl;
thefile2<<"The biggest number is: "<<endl;
thefile2<<"The smallest number is: "<<endl;
thefile2<<endl;