Here:
Code:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
const int SZ = 7;
double sales[SZ];
//Don't define x here
double highest = 0; //Initialize with 0, we will be assigning it a value later
for(int x = 0; x < SZ; x++) //Define x in each of the for statements
{
cout << "Enter sales for day " << (x + 1) << " >> ";
cin >> sales[x];
}
cout<<"The entered sales are: ";
for(int x = 0; x< SZ; x++)
{
cout<< sales[x] << " ";
}
for ( int x = 0; x < SZ; x++ )
{
if ( sales[x] > highest ) //Don't put sales[x] + 1, you want to scroll through ALL the values
{
highest = sales[x];
}
}
double lowest = highest; //Lowest goes here because we need the highest value to initially go in it
for ( int x = 0; x < SZ; x++ )
{
if( sales[x] < lowest ) //Again, no + 1
{
lowest = sales[x];
}
}
cout<<"\nThe lowest sale is "<<lowest<<endl;
cout<<"\nThe highest sale is "<<highest<<endl;
getch();
}
I fixed it up, I commented the errors so you should understand. I tested it. And it was only a couple of careless things you did wrong. Hopefully you learn from it.