can anyone be specific with me on trying to figure out this error....I have been reaqding my book and looking all over the net trying to solve it but all i have left is these two errors!!!!!!!
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void add_Record();
void get_Record();
void DisplayMenu();
int GetChoice();
bool Confirm();
void ProcessChoice(int);
int main()
{
int choice;
bool quit = false;
do
{
DisplayMenu();
choice = GetChoice();
if ( choice == 0 )
{
if (Confirm())
quit = true;
}
else
ProcessChoice(choice);
}while (!quit);
return 0;
}
void DisplayMenu()
{
cout << "1) Enter new patient\n";
cout << "2) List all smokers\n";
cout << "3) List all Male smokers\n";
cout << "4) List all Female smokers\n";
cout << "5) List all with risk factor greater than 5\n";
cout << "6) List all with risk factor less than 5\n";
cout << "7) Search by SS number\n";
cout << "8) List all by an age\n";
cout << "9) List all with HBP and HFD\n";
cout << "10) List Counts of Smokers, HFD, and HBP\n";
cout << "0) Exit\n";
}
int GetChoice()
{
int choice;
cout << " Enter a choice ";
cin >> choice;
return choice;
}
bool Confirm()
{
char choice = 'N';
bool rsp = false;
bool done = false;
do
{
cout<<" Are you sure to quit (Y/N)? ";
cin >> choice;
choice = toupper (choice);
if (choice == 'Y')
rsp = true;
if (choice == 'Y' || choice == 'N')
done = true;
else
done = false;
}while (!done);
return rsp;
}
void ProcessChoice(int c)
{
switch (c)
{
case 1:
add_Record();
{
ofstream outFile;
outFile.open ("records.dat", ios::app);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
cout << "Name: ";
cin >> name;
cout << "Gender: ";
cin >> gender;
cout << "Age: ";
cin >> age;
cout << "SSN: ";
cin >> ss;
cout << "Smoke: ";
cin >> smoke;
cout << "HBP (0/1):";
cin >> HBP;
cout << "HFD (0/1):";
cin >> HFD;
cout << "points (0/1):";
cin >> points;
outFile << name <<",";
outFile << gender <<" ";
outFile << age <<" ";
outFile << ss <<" ";
outFile << smoke <<" ";
outFile << HBP <<" ";
outFile << HFD <<" ";
outFile << points << endl;
outFile.close();
return;
}
break;
case 2:
get_Record();
{
ifstream inFile;
inFile.open ("records.dat", ios_base::in);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
if (inFile.is_open())
{
getline(inFile, name, ',');
inFile >> gender >> age >> ss >> smoke >> HBP >> HFD >> points;
cout << name <<", "<<"Gender: "<<gender<<", "<<"Age: "<<age<<", "<<"SS# "<<ss<<", ";
if (smoke == 1)
cout <<"Smoker, ";
else
cout <<"Non Smoker, ";
system ("pause");
}
else
cout<<"File could not be opened.\n";
inFile.close();
return;
}
break;
case 3:
get_Record();
{
ifstream inFile;
inFile.open ("records.dat", ios::in);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
if (inFile.is_open())
{
getline(inFile, name, ',');
inFile >> gender >> age >> ss >> smoke >> HBP >> HFD >> points;
cout<<name<<", "<<"Gender: "<<gender<<", "<<"Age: "<<age<<", "<<"SS# "<<ss<<", ";
if (smoke ==1 && gender == 'M')
cout <<"Smoker, ";
else
cout <<"Non Smoker, ";
system ("pause");
}
else
cout<<"File could not be opened.\n";
}
break;
case 4:
get_Record();
{
ifstream inFile;
inFile.open ("records.dat", ios::in);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
if (inFile.is_open())
{
getline(inFile, name, ',');
inFile >> gender >> age >> ss >> smoke >> HBP >> HFD >> points;
cout<<name<<", "<<"Gender: "<<gender<<", "<<"Age: "<<age<<", "<<"SS# "<<ss<<", ";
if (smoke ==1 && gender == 'F')
cout <<"Smoker, ";
else
cout <<"Non Smoker, ";
system ("pause");
}
else
cout<<"File could not be opened.\n";
}
break;
case 5:
get_Record();
{
ifstream inFile;
inFile.open ("records.dat", ios::in);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
if (inFile.is_open())
{
getline(inFile, name, ',');
inFile >> gender >> age >> ss >> smoke >> HBP >> HFD >> points;
cout<<name<<", "<<"Gender: "<<gender<<", "<<"Age: "<<age<<", "<<"SS# "<<ss<<", ";
if (points >= 5)
cout <<"Risk Factors Greater Than 5, ";
else
cout <<"Non Risk Factors Greater Than 5, ";
system ("pause");
}
else
cout<<"File could not be opened.\n";
}
break;
case 6:
get_Record();
{
ifstream inFile;
inFile.open ("records.dat", ios::in);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
if (inFile.is_open())
{
getline(inFile, name, ',');
inFile >> gender >> age >> ss >> smoke >> HBP >> HFD >> points;
cout<<name<<", "<<"Gender: "<<gender<<", "<<"Age: "<<age<<", "<<"SS# "<<ss<<", ";
if (points <= 5)
cout <<"Risk Factors Less Than 5, ";
else
cout <<"Non Risk Factors Less Than 5, ";
system ("pause");
}
else
cout<<"File could not be opened.\n";
}
break;
case 7:
get_Record();
{
ifstream inFile;
inFile.open ("records.dat", ios::in);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
if (inFile.is_open())
{
getline(inFile, name, ',');
inFile >> gender >> age >> ss >> smoke >> HBP >> HFD >> points;
cout<<"SS# "<<ss<<", "<<name<<", "<<"Gender: "<<gender<<", "<<"Age: "<<age<<", ";
system ("pause");
}
else
cout<<"File could not be opened.\n";
}
break;
case 8:
get_Record();
{
ifstream inFile;
inFile.open ("records.dat", ios::in);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
if (inFile.is_open())
{
getline(inFile, name, ',');
inFile >> gender >> age >> ss >> smoke >> HBP >> HFD >> points;
cout<<"Age: "<<age<<", "<<name<<", "<<"Gender: "<<gender<<", "<<"SS# "<<ss<<", ";
system ("pause");
}
else
cout<<"File could not be opened.\n";
}
break;
case 9:
get_Record();
{
ifstream inFile;
inFile.open ("records.dat", ios::in);
string name;
char gender;
int age;
int ss;
int smoke;
int HBP;
int HFD;
int points;
if (inFile.is_open())
{
getline(inFile, name, ',');
inFile >> gender >> age >> ss >> smoke >> HBP >> HFD >> points;
cout<<name<<", "<<"Gender: "<<gender<<", "<<"Age: "<<age<<", "<<"SS# "<<ss<<", ";
if (HBP ==1 && HFD == 1)
cout <<"HBP and HFD, ";
else
cout << "No HBP and HFD, ";
system ("pause");
}
else
cout<<"File could not be opened.\n";
}
break;
default:
cout<<"wrong choice!\n";
} ;
}
void add_Record()
{
{
ofstream outFile;
outFile.open ("records.dat", ios::app);
string name = "Ms. Johnson";
char gender = 'F'
;
int age = 33;
int ss = 123456788;
int smoke = 0;
int HBP = 0;
int HFD = 1;
int points = 4;
outFile << name <<",";
outFile << gender <<" ";
outFile << age <<" ";
outFile << ss <<" ";
outFile << smoke <<" ";
outFile << HBP <<" ";
outFile << HFD <<" ";
outFile << points << endl;
outFile.close();
return;
}
{
ofstream outFile;
outFile.open ("records.dat", ios::app);
string name = "Mr. Kime";
char gender = 'M'
;
int age = 19;
int ss = 123456888;
int smoke = 0;
int HBP = 1;
int HFD = 1;
int points = 4;
outFile << name <<",";
outFile << gender <<" ";
outFile << age <<" ";
outFile << ss <<" ";
outFile << smoke <<" ";
outFile << HBP <<" ";
outFile << HFD <<" ";
outFile << points << endl;
outFile.close();
return;
}
{
ofstream outFile;
outFile.open ("records.dat", ios::app);
string name = "Mrs. White";
char gender = 'F'
;
int age = 50;
int ss = 124356788;
int smoke = 0;
int HBP = 1;
int HFD = 1;
int points = 6;
outFile << name <<",";
outFile << gender <<" ";
outFile << age <<" ";
outFile << ss <<" ";
outFile << smoke <<" ";
outFile << HBP <<" ";
outFile << HFD <<" ";
outFile << points << endl;
outFile.close();
return;
}
{
ofstream outFile;
outFile.open ("records.dat", ios::app);
string name = "Mr. Long";
char gender = 'M'
;
int age = 27;
int ss = 121116788;
int smoke = 1;
int HBP = 1;
int HFD = 0;
int points = 8;
outFile << name <<",";
outFile << gender <<" ";
outFile << age <<" ";
outFile << ss <<" ";
outFile << smoke <<" ";
outFile << HBP <<" ";
outFile << HFD <<" ";
outFile << points << endl;
outFile.close();
return;
}
{
ofstream outFile;
outFile.open ("records.dat", ios::app);
string name = "Mrs. Hughes";
char gender = 'F'
;
int age = 43;
int ss = 123452768;
int smoke = 1;
int HBP = 1;
int HFD = 1;
int points = 10;
outFile << name <<",";
outFile << gender <<" ";
outFile << age <<" ";
outFile << ss <<" ";
outFile << smoke <<" ";
outFile << HBP <<" ";
outFile << HFD <<" ";
outFile << points << endl;
outFile.close();
return;
}
{
ofstream outFile;
outFile.open ("records.dat", ios::app);
string name = "Ms. Flinstone";
char gender = 'F'
;
int age = 17;
int ss = 124533248;
int smoke = 0;
int HBP = 0;
int HFD = 1;
int points = 2;
outFile << name <<",";
outFile << gender <<" ";
outFile << age <<" ";
outFile << ss <<" ";
outFile << smoke <<" ";
outFile << HBP <<" ";
outFile << HFD <<" ";
outFile << points << endl;
outFile.close();
return;
}
}
here are the errors:
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl get_Record(void)" (?get_Record@@YAXXZ) referenced in function "void __cdecl ProcessChoice(int)" (?ProcessChoice@@YAXH@Z)
1> fatal error LNK1120: 1 unresolved externals
1> 2 error(s), 0 warning(s)
help please