std::cout << "Enter the quarterly sales for North Division: " << std::endl;
North = getSales();
std::cout << "Enter the quarterly sales for South Division: " << std::endl;
South = getSales();
std::cout << "Enter the quarterly sales for East Division: " << std::endl;
East = getSales();
std::cout << "Enter the quarterly sales for West Division: " << std::endl;
West = getSales();
std::cout << "Enter the quarterly sales for Northeast Division: " << std::endl;
Northeast = getSales();
std::cout << "Enter the quarterly sales for Southeast Division: " << std::endl;
Southeast = getSales();
std::cout << "Enter the quarterly sales for Northwest Division: " << std::endl;
Northwest = getSales();
std::cout << "Enter the quarterly sales for Southwest Division: " << std::endl;
Southwest = getSales();
findHighest(North, South, East, West, Northeast, Southeast, Northwest, Southwest);
return 0;
}
double getSales()
{
double sales;
std::cin >> sales;
if(sales < 0)
{
std::cout << " Error: Invalid figures please enter above zero" << std::endl;
exit(0);
}
return sales;
}
void findHighest(double North,double South,double East,double West, double Northeast,double Southeast,double Northwest,double Southwest)
{
if (East > West && North > South)
{
if(North > South)
{
std::cout << "The North division had the greatest number of sales, $";
std::cout << North << std::endl;
}
if (North > South && West > East)
{
if(West > East)
{
std::cout << "The West division had the greatest number of sales, $";
std::cout << West << std::endl;
}
if (North > South && East > West)
{
if(East > West)
{
std::cout << "The East division had the greatest number of sales, $";
std::cout << East << std::endl;
}
if (East > West && South > North )
{
if(South > North)
{
std::cout << "The South division had the greatest number of sales, $";
std::cout << South << std::endl;
}
if (Northeast > Southeast && Northeast > Northwest)
{
if(Northeast > Southwest)
{
std::cout << "The Northeast division had the greatest number of sales, $";
std::cout << Northeast << std::endl;
}
}
if (Southeast > Northeast && Southeast > Northwest)
{
if(Southeast > Southwest)
{
std::cout << "The Southeast division had the greatest number of sales, $";
std::cout << Southeast << std::endl;
}
}
if (Northwest > Northeast && Northwest > Southeast)
{
if(Northwest > Southwest)
{
std::cout << "The Northwest division had the greatest number of sales, $";
std::cout << Northwest << std::endl;
}
}
if (Southwest > Northeast && Southwest > Southeast)
{
if(Southwest > Northwest)
{
std::cout << "The Southwest division had the greatest number of sales, $";
std::cout << Southwest << std::endl;
[ exit (0);][}]
If you use code tags via the <> in the toolbar on the right then the offending line 107 might be a bit easier to find. proper indentation while you're at it wouldn't go astray either. :)