/*
program discribtion:
*/
//this is the specification part
# include <iostream>
# include <string>
# include <iomanip>
usingnamespace std;
struct student
{
int id;
int Tcridits;
float gpa;
string major;
string department;
string college;
};
//puting all the prototypes
void addstud(student);
void showstud(student);
void deletstud(student);
void stats(student);
void sis(student);
int num=0;
int main()
{
student info[50];
int option;
do
{
cout << endl;
cout << "Student information System " << endl;
cout << " comp2101,assignment3"<<endl;
cout << "1.Add a new student "<<endl;
cout << "2.show an Extsting student"<<endl;
cout << "3.Delet an Existing student"<<endl;
cout << "4.show statistcs "<<endl;
cout << "5.print report "<<endl;
cout << "6.stop"<<endl;
cout << "enter your option "<<endl;
cin >> option;
switch (option)
{
case'1':
addstud(info[50]);
break;
case'2':
showstud(info[50]);
break;
case'3':
deletstud(info[50]);
break;
case'4':
stats(info[50]);
break;
case'5':
sis(info[50]);
break;
case'6':
cout <<"This is the end of the funct program ..."<<endl;
break;
default:
cout <<"pleas enter one of the options !!"<<endl;
}//end of switch
}while (option =='6');
return 0;
}//end of main
void addstud(student info[50])
{
cout << "Enter the id number"<<endl;
cin >> info[num].id;
cout << endl;
cout << "Enter total cridets : ";
cin >> info[num].Tcridits;
cout << endl;
cout << "Enter majour :";
cin >> info[num].major;
cout << endl;
cout << "Enter student Departement : ";
cin >> info[num].department;
cout << endl;
cout << "Enter student college :";
cin >> info[num].college;
cout << endl;
cout << "Data added "<<endl;
}//end of add function
void showstud(student info[50])
{
int ID;
cout <<"Enter the id ";
cin >> ID;
for (int x=0;x<=num;x++)
{
if (info[x].id == ID)
{
cout <<"student Id: "<< info[num].id<<endl;
cout <<"Total creadits: "<<info[num].Tcridits<<endl;
cout <<"Gpa : "<<info[num].gpa<<endl;
cout <<"Majour: "<<info[num].major<<endl;
cout <<"Department: "<<info[num].department<<endl;
cout <<"collage : "<<info[num].college<<endl;
return ;
}//end of if statment
}
cout << "the id dose not exist"<<endl;
}//end of function show student
void deletstud(student info[50])
{
int ID;
cout << "enter the id: ";
cin >> ID;
for (int x=0;x<=num;x++)
{
if (info[x].id == ID)
{
info[x].id=0;
cout <<"***student record found and has been deleted****"<<endl;
}
}//end of for
cout << "The student is not found "<<endl;
}//end of the function
void stats(student info[50])
{
int count1=0;
int count2=0;
for (int x=0;x<=num;x++)
{
if(info[x].gpa<2.0)
count1++;
if (info[x].gpa>3.0 && info[x].Tcridits>50)
count2++;
}//end of for
cout << "Student on probation: " <<count1;
cout << "Student on Honer list: "<<count2;
}//end of the function
void sis(student info[50])
{
cout <<"*** Thank you.Here is the final report on student data***"<<endl<<endl;
cout <<" Student ID "<<setw(6) << " Total Cridits "<<setw(6)<<" Gpa "<< setw(6) <<" Major "<< setw(8) <<" Department "<<setw(13)<<" college "<<endl;
for (int x=0;x<=num;x++)
{
if (info[x].id != '0' )
{
cout << setw(8) <<info[x].id << setw(10) << info[x].Tcridits << setw(13) << info[x].gpa << setw(7) << info[x].major << setw(13)<< info[x].department<<setw(16)<<info[x].college<<endl;
}
}//end of for
}//end of the function
these are the errors:
Error 3 error LNK2019: unresolved external symbol "void __cdecl deletstud(struct student)" (?deletstud@@YAXUstudent@@@Z) referenced in function _main HW3.obj
and the same for the other functions.
the compiler says that it can find the file specified.
By that you pass a pointer to a student instead of the actual student. That way you actually edit the students you pass to the function instead of copies of them. It's a bit hard to sum this up in a few lines, try reading this: http://www.cplusplus.com/doc/tutorial/pointers/