This is the current assignment:
Write a program that determines which of 5 geographic regions within a major city (north, south, east, west, and central) had the fewest reported automobile accidents last year. It should have the following two functions, which are called by main
int getNumAccidents() is passed the name of a region. It asks the user for the number of automobile accidents reported in that region during the last year, validates the input. then returns it. It should be called once for every city region.
void findLowest() is passed the five accident totals. It determines which is the smallest and prints the name of the region, along with its accident figures.
my current code:
#include <iostream>
using namespace std;
int getNumAccidents();
void findLowest();
int north, south, east, west, central
int main()
{
cout << "There will be 5 major geographic regions within the major city.\n"
<< "Please answer the question for each region.";
cout << "The firts region is the north";
getNumAccidents();
north = getNumAccidents();
cout << "The next region is the south.";
getNumAccidents();
south = getNumAccidents();
cout << "The next region is the east.";
getNumAccidents();
east = getNumAccidents();
cout << "The next region is the west.";
getNumAccidents();
west = getNumAccidents();
cout << "The next region is the central.";
getNumAccidents();
central = getNumAccidents();
findLowest();
}
int getNumAccidents()
{
int accidents = 0;
cout << "How many automobile accidents were reported\n"
<< "in the region during the last year?";
cin >> accidents;
if (accidents < 0)
{
cout << "ERROR: please enter a positive number";
cin >> accidents:
}
return accidents;
}
void findLowest()
{
Right now i'm stuck on the method of finding the lowest value and how i would associate that value with one of the regions. so pretty much the void findLowest() section