Here, I am providing you "Solution of Data Structure CS-301 Assignment No 2 due date 29-05-2018
Note: Please don't make exact copy of this document and make Changes in this assignment, write it in your own words always correct any errors if you found. I am not responsible for zero Marking.
Update: If you want to source file in CPP format then just visit the link given below to download Solution file of CS301
How to Download the File : Watch video below to see the steps to download file
Instructions
Steps 1: Click at link given above
2: Enter Captcha Code
3: Wait for 8 Seconds
4: Click at Link Generated below the captcha box
5: That's it. You have downloaded
Note: We guarantee you that our site is 100% Malware and virus free so please Please Disabled your Ad-blocker to Download the file from our site..
|
If you still facing any problem then please let me know about your problem regarding downloading file and leave a comment below because your feed back is very important to us to make our website more reliable and useful.
CS301 Assignment No. 2 Solution explanation is given below or download devc+ file from link given above;
Problem Statement:
A
testing service planned to conduct a recruitment test for both male and female
candidates. Two different persons are assigned for the clearance of candidates
in examination hall. Invigilator ’M’
will be assigned for male candidates while Invigilator ’F’ will be assigned for female candidates. In both cases candidates
will be served on first come and first serve basis. Equal number of male and
female candidates will appear in test and each invigilator will verify 25
candidates for the test. .
Solution Guidelines:
Question:
Write
C++ program to implement the above scenario. Your program should use array to
implement above scenario. It should be clear that candidates will be added on
rear side of the queue and will be served from front of the queue
Solution:
Here is the coding of assignment 2 solution
// for more update visit my profile ...infopalaces.blogspot.com
#include<iostream>
using namespace std;
struct node{
string roll_num, name, Last_deg;
char gender;
node *next;
};
void registering(node *&head, node *&last);
void Display_by_m(node *current);
void Display_by_f(node *current);
void Display_total(node *total);
void registering(node *&head, node *&last){
string r, n, l;
char g;
char a;
do{
cout<<"Enter Candidate Roll Number: ";
cin>>r;
cout<<"Enter Candidate Name: ";
cin>>n;
cout<<"Enter Candidate Gender: ";
cin>>g;
cout<<"Enter Candidate's Last Degree: ";
cin>>l;
if(head==NULL){
node *student = new node;
student->roll_num = r;
student->name = n;
student->gender = g;
student->Last_deg = l;
head = student;
last = student;
}else{
node *student = new node;
student->roll_num = r;
student->name = n;
student->gender = g;
student->Last_deg = l;
last->next = student;
last = student;
}
cout<<"\n Do you want to continue y/n: ";
cin>>a;
}while(a=='y'||a=='Y');
}
void Display_by_m(node *current){
while(current != NULL){
if(current->gender == 'm'){
cout<<"Total Candidate verified by invigilator M\n";
cout<<"RollNo: "<<current->roll_num<<endl;
cout<<"Name: "<<current->name<<endl;
cout<<"Gender: "<<current->gender<<endl;
cout<<"Last Degree: "<<current->Last_deg<<endl;
}
current = current->next;
}
}
void Display_by_f(node *current){
while(current != NULL){
if(current->gender=='f'){
cout<<"Total Candidate verified by invigilator F\n";
cout<<"RollNo: "<<current->roll_num<<endl;
cout<<"Name: "<<current->name<<endl;
cout<<"Gender: "<<current->gender<<endl;
cout<<"Last Degree: "<<current->Last_deg<<endl;
}
current = current->next;
}
}
void Display_total(node *total){
int count = 0; // Initialize count
struct node* current = total; // Initialize current
while (current != NULL)
{
count++;
current = current->next;
}
cout<<"Total Candidates verified by invigilator M and invigilator F: "<<count;
}
int main(){
int choice;
char b;
node *head = NULL;
node *last = NULL;
do{
cout<<"Menu\n\n";
cout<<"1: Register a new Candidate\n\n";
cout<<"2: Display List of Candidate verified by invigilater M\n\n";
cout<<"3: Display List of Candidate verified by invigilater F\n\n";
cout<<"4: Display Total Number of Candidates served\n\n";
cout<<"5: Exit\n";
cout<<"***********************************************************\n\n";
cout<<"Enter your Choice: ";
cin>>choice;
switch(choice)
{
case 1:
registering(head, last);
break;
case 2:
Display_by_m(head);
break;
case 3:
Display_by_f(head);
break;
case 4:
Display_total(head);
break;
default:
cout<<"system exit";
break;
}
cout<<"\nDo you want to back Menu y/n: ";
cin>>b;
}while(b=='y' || b=='Y');
return 0;
}
NOTE: IF YOU FOUND ANY MISTAKE THEN CORRECT IT PLEASE DON’T MAKE EXACT COPY OF THIS SOLUTION, MAKE CHANGES TO AVOID ZERO MARKING. IM NOT RESPONSIBLE FOR IT.
2 Comments
GREAT JOB WAQAS AHMED, SOLUTION IS VERY HELPFUL
ReplyDeletenice
ReplyDelete