#include <iostream>
#include <string>

using namespace std;

int getNumAccidents(string);
void findLowest(int, int, int, int, int);

int main()
{
	int counter, num, crash1, crash2, crash3, crash4, crash5;
	string n = "North", s = "South", w = "West", e = "East", c = "Central";

	for (counter = 0; counter < 5; counter++){
		
		cout << "Pick the reigon " << endl;
		cout << "1. " << n << endl 
		<< "2. " << s << endl 
		<< "3. " << w << endl
		<< "4. " << e << endl
		<< "5. Central" << c << endl;
		
		cin >> num;

		switch (num){
			case 1: crash1 = getNumAccidents(n);
					break;
			case 2: crash2 = getNumAccidents(s);
					break;
			case 3: crash3 = getNumAccidents(w);
					break;
			case 4: crash4 = getNumAccidents(e);
					break;
			case 5: crash5 = getNumAccidents(c);}
	}

	findLowest(crash1, crash2, crash3, crash4, crash5);
	
	system("pause");
	return 0;
}

int getNumAccident(string name)
{
	int crash;

	do{
		cout << "How many accidnts were in : " << name << endl;
		cin >> crash;
		
		if (crash < 0)
			cout << "Invalid entry please enter positive numbers only. " << endl;}
	while(crash < 0);

	return crash;
}

void findLowest(int crash1, int crash2, int crash3, int crash4, int crash5)
{
	if (crash1 < crash2 && crash1 < crash3 && crash1 && crash4 && crash1 < crash5){
		cout << "North has the least accidents " << endl
			<< "Accident Figures: " << crash1;}
	
	else if (crash2 < crash1 && crash2 < crash3 && crash2 && crash4 && crash2 < crash5){
		cout << "South has the least accidents " << endl
			<< "Accident Figures: " << crash2;}

	else if (crash3 < crash1 && crash3 < crash2 && crash3 && crash4 && crash3 < crash5){
		cout << "West has the least accidents " << endl
			<< "Accident Figures: " << crash3;}

	else if (crash4 < crash1 && crash4 < crash2 && crash4 && crash3 && crash4 < crash5){
		cout << "East has the least accidents " << endl
			<< "Accident Figures: " << crash4;}

	else if (crash5 < crash1 && crash5 < crash2 && crash5 && crash3 && crash5 < crash4){
		cout << "Central has the least accidents " << endl
			<< "Accident Figures: " << crash5;}
}

When I run this i get 1>SDA.obj : error LNK2019: unresolved external symbol "int __cdecl getNumAccidents(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?getNumAccidents@@YAHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
. I really need help on this one

Recommended Answers

All 2 Replies

Look at this

// defenition
int getNumAccidents(string)
// decleration
int getNumAccident(string name)

(hint) See how the ( don't line up.

Thank you sooo much. you really saved me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.