thank you guy's thats helped
i did most of the codes exept when i create the link list and stored them it dose not save them alphabeticallly by last name , and when editing i confused alot of stuff i dont know how to search for them by last name and edit one of them like for example change their grade. Can you guys help me
this is the code
#include <iostream>
using namespace std;
#define SIZE 100
struct student_list
{
char First_name [SIZE];
char Last_name [SIZE];
int ID;
float mid_grade,final_grade;
student_list *next; // pointer to next link
};
student_list *head=NULL;
student_list *current;
int option =0;
void enter_student (){
student_list *temp,*start;
temp = new student_list; // dynamiclly allocationg
cout << "Enter student first name "<<endl;
cin >> temp-> First_name;
cout << "Enter student last name "<<endl;
cin>> temp-> Last_name;
cout<< "please enter student ID "<<endl;
cin>>temp->ID;
cout<<"please enter midterm grade"<<endl;
cin>> temp->mid_grade;
cout<<"please enter final grade"<<endl;
cin>> temp->final_grade;
temp -> next = NULL;
if (head == NULL ){
head = temp;
current = head;
}
else {
start=head;
while (start ->next !=NULL){
start=start->next;
}
start->next=temp;
}
}
void display_lists(){
student_list *temp;
temp=head;
cout<<endl;
if(temp==NULL)
cout<<"you didnt enter any thing at all!! your list is empty"<<endl<<endl;
else{
while(temp !=NULL){
cout<<"student name: "<<temp->Last_name;
cout<<","<<temp-> First_name<<endl;
cout<<"ID number: "<<temp->ID<<endl;
cout<<"first midterm grade: "<<temp->mid_grade<<endl;
cout<<"final exam grade: "<<temp->final_grade<<endl<<endl;
temp = temp -> next;
}
cout<< "LIST ENDED !"<<endl;
}
}
void edit(){
student_list *temp,*y;
int strcmp(char *name1,char *name2);
temp = head;
head = head -> next;
cout<<"enter student last name please: "<<endl;
cin>>name1-;
name2=name2->next;
if (name1 = name2){
return 0;
}
else if ( name1>name2){
return >0;
}
else if (name2>name1){
retun <0;
}
if(strcmp(y->name1,temp->name1)==0)
}
int main ()
{
head = NULL;
while ( option != 4){
cout <<"Welcome to bos3ayed C++ writer company "<<endl;
cout << " this program help you to orginzing your student information";
cout<<". first name , last name , ID, first midterm grade, and final"<<endl;
cout <<endl<<endl;
cout<< "Choose what do you want to do from this menu (1,2,3,4)"<<endl;
cout<<"1) Enter new student"<<endl;
cout<<"2) Edit existing student ( serch by name)"<<endl;
cout<<"3) Display list "<<endl;
cout<<"4) Exit"<<endl;
cin>> option;
switch (option){
case 1 : enter_student();
break;
case 3 : display_lists();
break;
case 2 : edit ();
break;
}
}
return 0;
system("pause");
}
--------------------------------------------------------------------------
thanks in advance,