JackOfAllTrades, on 10 December 2010 - 09:23 AM, said:
void findHighest(int north, int south, int east, int west, int central,int numAccidents);
{
Lose that semi-colon.
Already did that..tell me something else.




Posted 10 December 2010 - 11:18 AM
Posted 10 December 2010 - 11:29 AM
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
void findLowest(int north, int south, int east, int west, int central,int numAccidents);
void findHighest(int north, int south, int east, int west, int central,int numAccidents);
int getNumAccidents(string regionName);
int main()
{
string regName;
int north,
south,
east,
west,
central,
numAccidents;
cout << "There will be 5 regions within the major city.\n";
{
regName="north:";
north = getNumAccidents(regName);
regName="south:";
south = getNumAccidents(regName);
regName="east:";
east = getNumAccidents(regName);
regName="west:";
west = getNumAccidents(regName);
regName="central:";
central = getNumAccidents(regName);
}
findLowest(north, south, east, west, central, numAccidents);
findHighest(north, south, east, west, central, numAccidents);
{int numAccidents = 0;}
return 0;
}
int getNumAccidents(string regionName)
{
int numAccidents;
do
{
cout << "Enter the number of accidents for " << regionName;
cin >> numAccidents;
}
while (numAccidents < 0);
return numAccidents;
}
void findLowest(int north, int south, int east, int west, int central,int numAccidents)
{
string regName;
{
if (numAccidents > north)
{
regName = "north";
numAccidents = north;
}
if (numAccidents > south)
{
regName = "south";
numAccidents = south;
}
if (numAccidents > east)
{
regName = "east";
numAccidents = east;
}
if (numAccidents > west)
{
regName = "west";
numAccidents = west;
}
if (numAccidents > central)
{
regName = "central";
numAccidents = central;
}
}
cout << "The Lowest Region is " << regName << endl;
}
void findHighest(int north, int south, int east, int west, int central,int numAccidents)
{
string regName;
{
if (numAccidents < north)
{
regName = "north";
numAccidents = north;
}
if (numAccidents < south)
{
regName = "south";
numAccidents = south;
}
if (numAccidents < east)
{
regName = "east";
numAccidents = east;
}
if (numAccidents < west)
{
regName = "west";
numAccidents = west;
}
if (numAccidents < central)
{
regName = "central";
numAccidents = central;
}
}
cout << "The Highest Region is " << regName << endl;
}
Posted 10 December 2010 - 11:59 AM
Quote
Quote
Quote
Posted 10 December 2010 - 01:21 PM
jimblumberg, on 10 December 2010 - 10:59 AM, said:
Quote
Quote
Quote
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int getNumAccidents(string regionName);
int main()
{
string regName;
int north,
south,
east,
west,
central;
cout << "There will be 5 regions within the major city.\n";
{
regName="north:";
north = getNumAccidents(regName);
regName="south:";
south = getNumAccidents(regName);
regName="east:";
east = getNumAccidents(regName);
regName="west:";
west = getNumAccidents(regName);
regName="central:";
central = getNumAccidents(regName);
}
int numAccidents = 0;
void findLowest(int north, int south, int east, int west, int central,int numAccidents);
void findHighest(int north, int south, int east, int west, int central,int numAccidents);
findLowest(north, south, east, west, central, numAccidents);
findHighest(north, south, east, west, central, numAccidents);
return 0;
}
int getNumAccidents(string regionName)
{
int numAccidents;
do
{
cout << "Enter the number of accidents for " << regionName;
cin >> numAccidents;
}
while (numAccidents < 0);
return numAccidents;
}
void findLowest(int north, int south, int east, int west, int central,int numAccidents)
{
string regName;
{
if (numAccidents > north)
{
regName = "north";
numAccidents = north;
}
if (numAccidents > south)
{
regName = "south";
numAccidents = south;
}
if (numAccidents > east)
{
regName = "east";
numAccidents = east;
}
if (numAccidents > west)
{
regName = "west";
numAccidents = west;
}
if (numAccidents > central)
{
regName = "central";
numAccidents = central;
}
}
cout << "The Lowest Region is " << regName << endl;
}
void findHighest(int north, int south, int east, int west, int central,int numAccidents)
{
string regName;
{
if (numAccidents < north)
{
regName = "north";
numAccidents = north;
}
if (numAccidents < south)
{
regName = "south";
numAccidents = south;
}
if (numAccidents < east)
{
regName = "east";
numAccidents = east;
}
if (numAccidents < west)
{
regName = "west";
numAccidents = west;
}
if (numAccidents < central)
{
regName = "central";
numAccidents = central;
}
}
cout << "The Highest Region is " << regName << endl;
}
Posted 10 December 2010 - 02:06 PM
void findLowest(int north, int south, int east, int west, int central,int numAccidents); void findHighest(int north, int south, int east, int west, int central,int numAccidents);
int numAccidents = 0; // Change this 0 to 100000.
findLowest(north, south, east, west, central, numAccidents);
numAccidents = 0; // Add this line.
findHighest(north, south, east, west, central, numAccidents);
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
