www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS301 Data Structures Assignment No 02 Fall 2020 Solution / Discussion

CS301 Data Structures Assignment No 02 Fall 2020 Solution / Discussion

Views: 1875

### Replies to This Discussion

Share the Assignment Questions & Discuss Here....

CS301_Assignment_No_02_Solution_Fall_2020

CS301_Assignment_No_02_Solution_Fall_2020

CS301_Assignment_No_02_Solution_Fall_2020

cs301 Corect Solution

cs301 Corect Solution

# CS301 Assignment No. 2 Fall 2020 || 100% Correct Solution by VU ACADEMY

CS301_Assignment_No_02_Solution_Fall_2020

CS301_Assignment_No_02_Solution_Fall_2020

CS301 Assignment 2 Fall 2020 Solution:

#include
#include
using namespace std;
class queue // Queue Class For Storing Data
{
public:
int age,blood,heart,covid;
string name,gender;
};
class list // Linked List Class For Storing Nodes.
{
private:
public:
void insert();
void display();
void count();
};
void list::insert()
{
system("cls");
int a,b,h,c;
string n,g;
// Take Patient Information.
cout"\n\t\t\t\tNew Patient";
cout"\n\n Name : ";
cin>>n;
cout"\n\n Age : ";
cin>>a;
cout"\n\n Gender : ";
cin>>g;
cout"\n\n Blood Sugar (1 for Positive 0 for Negtive) : ";
cin>>b;
cout"\n\n Heart Decease (1 for Positive 0 for Negtive) : ";
cin>>h;
cout"\n\n COVID-19 (1 for Positive 0 for Negtive) : ";
cin>>c;
// Insert Record into Node.
queue *new_node = new queue;
new_node -> name = n;
new_node -> age = a;
new_node -> gender = g;
new_node -> blood = b;
new_node -> heart = h;
new_node -> covid = c;
else
{
// Check Last Node.
{
}
}
cout"\n\n Patient Information Inserted Successfully...";
}
void list::display()
{
system("cls");
cout"\n\t\t\t\tDisplay All Information";
while(ptr != NULL)
{
cout"\n\n Name : "< name;
cout"\n\n Age : "< age;
cout"\n\n Gender : "< gender;
(ptr -> blood == 1) ? cout"\n\n Blood Sugar : Positive" : cout"\n\n Blood Sugar : Negtive";
(ptr -> heart == 1) ? cout"\n\n Heart Decease : Positive" : cout"\n\n Heart Decease : Negtive";
(ptr -> covid == 1) ? cout"\n\n COVID-19 : Positive" : cout"\n\n COVID-19 : Negtive";
cout"\n\n **************************************";
}
}
void list::count()
{
int m=0,f=0,k=0,o=0,b=0,h=0,c=0,r=0;
cout"\n\n\n\t\t\t\tCounted Information";
while(ptr != NULL)
{
if(ptr -> gender == "Male" || ptr -> gender == "male")
m++;
else
f++;
if(ptr -> age < 15)
k++;
else if(ptr -> age > 50)
o++;
if(ptr -> blood == 1)
b++;
if(ptr -> heart == 1)
h++;
if(ptr -> covid == 1)
c++;
if(ptr -> blood == 1 && ptr -> heart == 1 && ptr -> covid == 1 && ptr -> age > 50)
r++;
}
cout"\n\n Number Of Male Patients : "m;
cout"\n\n Number Of Female Patients : "f;
cout"\n\n Number Of Kids Patients : "k;
cout"\n\n Number Of Patients Have Age Over 50 : "o;
cout"\n\n Number Of Patients Have Blood Sugar Decease : "b;
cout"\n\n Number Of Patients Have Heart Decease : "h;
cout"\n\n Number Of Patients Have COVID-19 : "c;
cout"\n\n Number Of High Risk Patients : "r;
}
main() // Main Function
{
list l;
char choice;
// Call Insert Function.
do
{
l.insert();
cout"\n\n Do You Want Add Another Patient (Y,N) : ";
cin>>choice;
}while(choice == 'y' || choice == 'Y');
// Call Display Function.
l.display();
// Call Count Information Function.
l.count();
getch();
return 0;
}

there is error in this code

#CS301_Assignment2_fall2020 #vuhelp #virtualuniversity
CS301 Assignment No.2 Idea Solution✅ Fall 2020✅ Virtual University

#CS301ASSIGNMENTNO2FALL2020cs301cs301 assignmentcs301 assignment 2cs301 assignment 2 solutioncs301 assignment 2 solution 2019cs301 assignment 2 solution 2020cs301 assignment 2 solution fall 2018cs301 assignment 2 solution fall 2019cs301 assignment 2 solution spring 2020cs301 assignment 2020cs301 assignment no 2cs301 assignment no 2 solutioncs301 assignment no 2 solution 2020cs301 assignment no 2 solution spring 2020cs301 assignment solutioncs301 pdfcs301 solutioncs301 solved pdf

CS301-ASSIGNMENT-NO2-FALL-2020-SOLUTION

CS301 assignment 2 Solution idea 2:

#include<iostream>
#include<conio.h>
using namespace std;
class queue // Queue Class For Storing Data
{
public:
int age,blood,heart,covid;
string name,gender;
};
class list // Linked List Class For Storing Nodes.
{
private:
public:
void insert();
void display();
void count();
};
void list::insert()
{
system("cls");
int a,b,h,c;
string n,g;
// Take Patient Information.
cout"\n\t\t\t\tNew Patient";
cout"\n\n Name : ";
cin>>n;
cout"\n\n Age : ";
cin>>a;
cout"\n\n Gender : ";
cin>>g;
cout"\n\n Blood Sugar (1 for Positive 0 for Negtive) : ";
cin>>b;
cout"\n\n Heart Decease (1 for Positive 0 for Negtive) : ";
cin>>h;
cout"\n\n COVID-19 (1 for Positive 0 for Negtive) : ";
cin>>c;
// Insert Record into Node.
queue *new_node = new queue;
new_node -> name = n;
new_node -> age = a;
new_node -> gender = g;
new_node -> blood = b;
new_node -> heart = h;
new_node -> covid = c;
else
{
// Check Last Node.
{
}
}
cout"\n\n Patient Information Inserted Successfully...";
}
void list::display()
{
system("cls");
cout"\n\t\t\t\tDisplay All Information";
while(ptr != NULL)
{
cout"\n\n Name : "ptr -> name;
cout"\n\n Age : "ptr -> age;
cout"\n\n Gender : "ptr -> gender;
(ptr -> blood == 1) ? cout"\n\n Blood Sugar : Positive" : cout"\n\n Blood Sugar : Negtive";
(ptr -> heart == 1) ? cout"\n\n Heart Decease : Positive" : cout"\n\n Heart Decease : Negtive";
(ptr -> covid == 1) ? cout"\n\n COVID-19 : Positive" : cout"\n\n COVID-19 : Negtive";
cout"\n\n **************************************";
}
}
void list::count()
{
int m=0,f=0,k=0,o=0,b=0,h=0,c=0,r=0;
cout"\n\n\n\t\t\t\tCounted Information";
while(ptr != NULL)
{
if(ptr -> gender == "Male" || ptr -> gender == "male")
m++;
else
f++;
if(ptr -> age < 15)
k++;
else if(ptr -> age > 50)
o++;
if(ptr -> blood == 1)
b++;
if(ptr -> heart == 1)
h++;
if(ptr -> covid == 1)
c++;
if(ptr -> blood == 1 && ptr -> heart == 1 && ptr -> covid == 1 && ptr -> age > 50)
r++;
}
cout"\n\n Number Of Male Patients : "m;
cout"\n\n Number Of Female Patients : "f;
cout"\n\n Number Of Kids Patients : "k;
cout"\n\n Number Of Patients Have Age Over 50 : "o;
cout"\n\n Number Of Patients Have Blood Sugar Decease : "b;
cout"\n\n Number Of Patients Have Heart Decease : "h;
cout"\n\n Number Of Patients Have COVID-19 : "c;
cout"\n\n Number Of High Risk Patients : "r;
}
main() // Main Function
{
list l;
char choice;
// Call Insert Function.
do
{
l.insert();
cout"\n\n Do You Want Add Another Patient (Y,N) : ";
cin>>choice;
}while(choice == 'y' || choice == 'Y');
// Call Display Function.
l.display();
// Call Count Information Function.
l.count();
getch();
return 0;
}

cs301 Corect Solution

cs301 Corect Solution

1

2

3

4

5

## Latest Activity

31 minutes ago
1 hour ago
иαвєєℓ αнмє∂ posted discussions
1 hour ago

### Poetry

1 hour ago
♥ + Kamli + ♥ liked иαвєєℓ αнмє∂'s discussion !!!! Yaad !!!!
1 hour ago
♥ + Kamli + ♥ liked иαвєєℓ αнмє∂'s discussion !!!! Chalo Mana !!!!!
1 hour ago
♥ + Kamli + ♥ liked иαвєєℓ αнмє∂'s discussion !!! Kahin sy tu aajaaa !!!
1 hour ago
♥ + Kamli + ♥ liked ASIM!!'s discussion Faisla
1 hour ago