1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include<iostream> //Header File for console I/O
using namespace std;
void getAccidents( int &, int &,int &,int &,int &) ;
void findLowerst(int, int, int, int, int);
// begin min Function Definition
int main()
{
int crashN, crashE, crashS, crashC, crashW;
getAccidents(crashN, crashE, crashS, crashC, crashW);
findLowerst(crashN, crashE, crashS, crashC, crashW);
system("pause");
return 0;
} //end of main function.
void getAccidents(int regN, int regE, int regS, int regC, int regW)
{
char area;
int crashes;
cout << "text" << endl;
cin >> area;
switch(area)
{
case NORTH : cout << "NORTH";
break;
case EAST : cout << "EAST";
break;
case SOUTH : cout << "SOUTH";
break;
case CENTRAL : cout << "CENTRAL";
break;
case WEST : cout << "WEST";
}
cout << "area";
cin >> crashes;
while (crashes < 0)
{
cout << "teh acciednt total cannot be negative"
<< "please re-enter";
cin >> crashes;
}
return crashes;
}
void findLowerst(int N, int E, int S ,int C ,int W )
{
int lowest = N;
if ( E < lowest) lowest = E
if ( S < lowest) lowest = S
if ( C < lowest) lowest = C
if ( W < lowest) lowest = W
cout << "" << "\n";
if ( lowest == N) cout "North\n";
if ( lowest == E) cout "EAST\n";
if ( lowest == S) cout "SOUTH\n";
if ( lowest == C) cout "CENTRAL\n";
if ( lowest == W) cout "WEST\n";
cout << "" << lowest << "accents\n";
}
|