I need help with finding the minimum value of x but I can't seem to get the code right. Please Help. Noob :sad:
#include<iostream>
using std::cout;
using std::cin;
int main()
{
int x; // x is the duration of the call
double sum;
int number;
double average;
sum = 0;
number =1;
int max = 0;
int min = 0;
cout<<"Enter telephone call " << number << ": ";
while (cin>>x)
{
if (x > max) // find longest call
{
max = x;
}
if (min < x) // find shortest call ?
{
x = min;
}
sum += x; // sum = sum +
number++; // number = number + 1
cout<<"Enter telephone call " << number << ": "; // keeps a space after the colon.
}// close while
average = sum/--number; //(number-1) I put the -- in front of number because
// subtract # before dividing.
cout<<"The Longest call in minutes is " << max;
cout<<"\nThe Shortest call in minutes is "<< min;
cout<<"\nThe Number of calls made are "<<number++;
cout<<"\nThe average time of the calls are "<< average;
cout<<'\n';
return 0;
} //close main