This is my code but not complete please complete my code rel





This is my code but not complete, please complete my code related by lab#4
And i wans results for output in black screen.


#include<iostream>
#include<limits>
#define MAX 100;

using namespace std;
struct date
{
int day,month,year\'
};

struct STUDENT_TYPE
{
string name;
int id;
double GPA;
date DOB;
};

int i=0;
int main()
{
STUDENT_TYPE student[MAX];
int choice=-1;
while(choice!=0)
{
cout<<\"\ 0-Exit\ 1-Insert\ 2-Delete_last\ 3-Display\ 4-Search\ 5-Deletion_particular_record\ 6-Insert_after_record\ 7-Sort(acending)\";
cout<<\"Enter your choice:\";
cin>>choice;
switch(choice)
{
case 0exit(0);
case 1:insert();break;
case 2:delete();break;
case 3:display();break;
case 4:searcht();break;
case 5:delete();break;
case 6:insert();break;
case 7:sort();break;
default:cout<<\"Wrong selection\";
}
}
return 0;
}


void insert()

{
cout<<\"Enter the student details:\";
cout<<\"student name:\";
cin>>student[i].name;
cout<<\"student id:\";
cin>>student[i].id;
cout<<\"student GPA:\";
cin>>student[i].GPA;
cout<<\"student DOB\";
cin>>student[i].DOB.day>>student[i].DOB.month>>student[i].DOB.year;
i++;
}




void delete()
{
//assign 0 to last pointed record
student[i].name=0;
student[i].id=0;
student[i].GPA=0;
student[i].DOB.day=0;student[i].DOB.month=0;student[i].DOB.year=0;
i--;
}



void display ()
{
cout<<\"student details are\ \";
for(int n=0; n<i;n++)
{
cout<<student[n].name<<student[n].id<<student[n].GPA<<student[n].DOB.day<<student[n].DOB.month<<student[n].DOB.year;
cout\"\ \";
}
}




void search()
{
boolean record=false;
int id
cout<<\"Enter student id to search in the list:\";
cin>>id;
for(int n=0;n<i;n++)
{
if (student[n].id==id)
{
cout<<\"student with\"<<id<<\"is present in the list\";
record=true;
break;
}
}
if(!record)
cout<<\"student with\"<<id<<\"is not present in the list\";
}



void delete2()

{
int record;
cout<<enter the student id you want to delete:\";
cin>>record;
for(int n=0;n<i;n++)
if(student[n].id==record)
{
find=n;
break;
}
}


for(int k=find;k<i;++k)
{
//move all records forward from current position
student[k].name=student[k+1].name;
student[k].id=student[k+1].id;
student[k].GPA=student[k+1].GPA;
student[k].DOB.day=student[k+1].DOB.day;
student[k].DOB.month=student[k+1].DOB.month;
student[k].DOB.year=student[k+1].DOB.year;
}
}



void insert2()
{
int pos,id;
cout<<\"after which student id you want to insert the record:\";
cin>>id;
for(int n=0;n<i;n++)
{
(if student [n].id==id)
{
n=pos;
break;
}
}
for(int p=++i;p>pos;p--)
{
// move all record towards right to make space for insertion of new record
student[p].name=student[p-1].name;
student[p].id=student[p-1].id;
student[p].GPA=student[p-1].GPA;
student[p].DOB.day=student[p-1].DOB.day;
student[p].DOB.month=student[p-1].DOB.month;
student[p].DOB.year=student[p-1].DOB.year;
}
cout<<\"enter the student details:\";
cout<<\"student name:\";
cin>>student[pos].name;
cout<<\"student id:\";
cin>>student[pos].id;
cout<<\"student GPA:\";
cin>>student[pos].GPA;
cout<<\"student DOB:\";
cin>>student[pos].DOB.day>>student[pos].DOB.month>>student[pos].DOB.year;
}



void sort()

{
// bubble sorting technique is used
struct STUDENT_TYPE TEMP[2];
for(intx=0;x<i;x++)
{
for(int y=0; y<=i-x;y++)
{
if(student[y].id>student[y+1]id)
{
//move all the record information to temp and swap them
temp[0].name=student[j].name;
temp[j].name=student[j+1].name;
temp[j+1].name=student[0].name;
//the above three lines are repeated for all the student fields
}
}
}
}

#include<iostream>
#include<limits>
#define MAX 100;

using namespace std;
struct date
{
int day,month,year\'
};

struct STUDENT_TYPE
{
string name;
int id;
double GPA;
date DOB;
};

int i=0;
int main()
{
STUDENT_TYPE student[MAX];
int choice=-1;
while(choice!=0)
{
cout<<\"\ 0-Exit\ 1-Insert\ 2-Delete_last\ 3-Display\ 4-Search\ 5-Deletion_particular_record\ 6-Insert_after_record\ 7-Sort(acending)\";
cout<<\"Enter your choice:\";
cin>>choice;
switch(choice)
{
case 0exit(0);
case 1:insert();break;
case 2:delete();break;
case 3:display();break;
case 4:searcht();break;
case 5:delete();break;
case 6:insert();break;
case 7:sort();break;
default:cout<<\"Wrong selection\";
}
}
return 0;
}


void insert()

{
cout<<\"Enter the student details:\";
cout<<\"student name:\";
cin>>student[i].name;
cout<<\"student id:\";
cin>>student[i].id;
cout<<\"student GPA:\";
cin>>student[i].GPA;
cout<<\"student DOB\";
cin>>student[i].DOB.day>>student[i].DOB.month>>student[i].DOB.year;
i++;
}




void delete()
{
//assign 0 to last pointed record
student[i].name=0;
student[i].id=0;
student[i].GPA=0;
student[i].DOB.day=0;student[i].DOB.month=0;student[i].DOB.year=0;
i--;
}



void display ()
{
cout<<\"student details are\ \";
for(int n=0; n<i;n++)
{
cout<<student[n].name<<student[n].id<<student[n].GPA<<student[n].DOB.day<<student[n].DOB.month<<student[n].DOB.year;
cout\"\ \";
}
}




void search()
{
boolean record=false;
int id
cout<<\"Enter student id to search in the list:\";
cin>>id;
for(int n=0;n<i;n++)
{
if (student[n].id==id)
{
cout<<\"student with\"<<id<<\"is present in the list\";
record=true;
break;
}
}
if(!record)
cout<<\"student with\"<<id<<\"is not present in the list\";
}



void delete2()

{
int record;
cout<<enter the student id you want to delete:\";
cin>>record;
for(int n=0;n<i;n++)
if(student[n].id==record)
{
find=n;
break;
}
}


for(int k=find;k<i;++k)
{
//move all records forward from current position
student[k].name=student[k+1].name;
student[k].id=student[k+1].id;
student[k].GPA=student[k+1].GPA;
student[k].DOB.day=student[k+1].DOB.day;
student[k].DOB.month=student[k+1].DOB.month;
student[k].DOB.year=student[k+1].DOB.year;
}
}



void insert2()
{
int pos,id;
cout<<\"after which student id you want to insert the record:\";
cin>>id;
for(int n=0;n<i;n++)
{
(if student [n].id==id)
{
n=pos;
break;
}
}
for(int p=++i;p>pos;p--)
{
// move all record towards right to make space for insertion of new record
student[p].name=student[p-1].name;
student[p].id=student[p-1].id;
student[p].GPA=student[p-1].GPA;
student[p].DOB.day=student[p-1].DOB.day;
student[p].DOB.month=student[p-1].DOB.month;
student[p].DOB.year=student[p-1].DOB.year;
}
cout<<\"enter the student details:\";
cout<<\"student name:\";
cin>>student[pos].name;
cout<<\"student id:\";
cin>>student[pos].id;
cout<<\"student GPA:\";
cin>>student[pos].GPA;
cout<<\"student DOB:\";
cin>>student[pos].DOB.day>>student[pos].DOB.month>>student[pos].DOB.year;
}



void sort()

{
// bubble sorting technique is used
struct STUDENT_TYPE TEMP[2];
for(intx=0;x<i;x++)
{
for(int y=0; y<=i-x;y++)
{
if(student[y].id>student[y+1]id)
{
//move all the record information to temp and swap them
temp[0].name=student[j].name;
temp[j].name=student[j+1].name;
temp[j+1].name=student[0].name;
//the above three lines are repeated for all the student fields
}
}
}
}


Lab 3 1. Design a structure named student that will contain following information: Name (string) ID (int) GPA (double Major (string) 1.1: Calculate the total amount of space your structure will occupy in memory (RAM). You can assume any size for the data type you will use. E.g. 2 Byte for int, 4 Byte for double etc. 1.2 From the main program/function create 3 student records and assign values for all fields. Then (1) find the best student. (2) search for student with the ID=101. 2. Repeat the task 1 that will handle any number of students. Hints: use the array of record 3. Add another field \'DOB\' in the structure to store the date of birth of the students. Hints: Use another structure e.g. dateType to store day, month and year. 4. Find the eldest person in the list (challenge problem. Let me know if you could do it). 5. Write a C++ program that takes N number of integers as input in an array of int. Then determines the max and min from the list (array)

Solution

#include<iostream>

#include<limits>

#define MAX 100;

using namespace std;

struct date

{

   int day,month,year\'

  

};

struct STUDENT_TYPE

{

   string name;

   int id;

   double GPA;

   date DOB;

};

int i=0;

int main()

{

   STUDENT_TYPE student[MAX];

   int choice=-1;

   while(choice!=0)

   {

       cout<<\"\ 0-Exit\ 1-Insert\ 2-Delete_last\ 3-Display\ 4-Search\ 5-Deletion_particular_record\ 6-Insert_after_record\ 7-Sort(acending)\";

       cout<<\"Enter your choice:\";

       cin>>choice;

       switch(choice)

       {

           case 0exit(0);

           case 1:insert();break;

           case 2:delete();break;

           case 3:display();break;

           case 4:searcht();break;

           case 5:delete();break;

           case 6:insert();break;

           case 7:sort();break;

           default:cout<<\"Wrong selection\";

          

       }

   }

  

   return 0;

}

void insert()

{

   cout<<\"Enter the student details:\";

   cout<<\"student name:\";

cin>>student[i].name;

cout<<\"student id:\";

cin>>student[i].id;

cout<<\"student GPA:\";

cin>>student[i].GPA;

cout<<\"student DOB\";

cin>>student[i].DOB.day>>student[i].DOB.month>>student[i].DOB.year;

i++;

}

void delete()

{

   //assign 0 to last pointed record

   student[i].name=0;

   student[i].id=0;

   student[i].GPA=0;

   student[i].DOB.day=0;student[i].DOB.month=0;student[i].DOB.year=0;

   i--;

}

void display ()

{

  

   cout<<\"student details are\ \";

   for(int n=0; n<i;n++)

   {

       cout<<student[n].name<<student[n].id<<student[n].GPA<<student[n].DOB.day<<student[n].DOB.month<<student[n].DOB.year;

       cout\"\ \";

   }

}

void search()

{

   boolean record=false;

   int id

   cout<<\"Enter student id to search in the list:\";

   cin>>id;

   for(int n=0;n<i;n++)

   {

       if (student[n].id==id)

       {

           cout<<\"student with\"<<id<<\"is present in the list\";

           record=true;

           break;

       }

   }

  

  

   if(!record)

       cout<<\"student with\"<<id<<\"is not present in the list\";

}

void delete2()

{

   int record;

   cout<<enter the student id you want to delete:\";

   cin>>record;

   for(int n=0;n<i;n++)

       if(student[n].id==record)

       {

          

           find=n;

           break;

          

       }

}

for(int k=find;k<i;++k)

{

  

   //move all records forward from current position

   student[k].name=student[k+1].name;

   student[k].id=student[k+1].id;

   student[k].GPA=student[k+1].GPA;

   student[k].DOB.day=student[k+1].DOB.day;

   student[k].DOB.month=student[k+1].DOB.month;

   student[k].DOB.year=student[k+1].DOB.year;

  

}

}

void insert2()

{

   int pos,id;

   cout<<\"after which student id you want to insert the record:\";

   cin>>id;

  

   for(int n=0;n<i;n++)

   {

       (if student [n].id==id)

       {

           n=pos;

           break;

          

       }

   }

  

   for(int p=++i;p>pos;p--)

   {

       // move all record towards right to make space for insertion of new record

       student[p].name=student[p-1].name;

       student[p].id=student[p-1].id;

       student[p].GPA=student[p-1].GPA;

       student[p].DOB.day=student[p-1].DOB.day;

       student[p].DOB.month=student[p-1].DOB.month;

       student[p].DOB.year=student[p-1].DOB.year;

      

      

   }

  

   cout<<\"enter the student details:\";

   cout<<\"student name:\";

   cin>>student[pos].name;

   cout<<\"student id:\";

   cin>>student[pos].id;

   cout<<\"student GPA:\";

   cin>>student[pos].GPA;

   cout<<\"student DOB:\";

   cin>>student[pos].DOB.day>>student[pos].DOB.month>>student[pos].DOB.year;

}

void sort()

{

   // bubble sorting technique is used

  

   struct STUDENT_TYPE TEMP[2];

   for(intx=0;x<i;x++)

   {

       for(int y=0; y<=i-x;y++)

       {

           if(student[y].id>student[y+1]id)

           {

              

               //move all the record information to temp and swap them

              

               temp[0].name=student[j].name;

               temp[j].name=student[j+1].name;

               temp[j+1].name=student[0].name;

              

               //the above three lines are repeated for all the student fields

           }

       }

   }

}

 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<
 This is my code but not complete, please complete my code related by lab#4 And i wans results for output in black screen. #include<iostream> #include<

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site