We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search


+ Link For Assignments, GDBs & Online Quizzes Solution


+ Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

CS301 Data Structures Assignment No 01 Solution & Discussion Spring 2019 Due Date: May 14, 2019

CS301 Data Structures Assignment No 01 Solution & Discussion Spring 2019 Due Date: May 14, 2019

CS301 - Data Structures Assignment No. 1 Discussion & Solution Spring 2019 Due Date: May 14, 2019 

Assignment No. 01 
SEMESTER Spring 2019
CS301- Data Structures


Total Marks: 20


Due Date: 14/05/19


Please read the following instructions carefully before solving & submitting assignment:

It should be clear that your assignment will not get any credit (zero marks) if:

o        The assignment is submitted after due date.

o        The submitted code does NOT compile.

o        The submitted assignment is other than .CPP file.

o        The submitted assignment does NOT open or file is corrupted.

o        The assignment is copied (from other student or ditto copy from handouts or internet).

Uploading instructions

For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file.


Note: Use ONLY Dev-C++ IDE.


The objective of this assignment is


o   To make you familiar of Programming with List Data Structure.


For any query about the assignment, contact at cs301@vu.edu.pk




Marks: 20 


Problem Statement:

You have to implement a List Data Structure of student profile information records by using Array in C++ language. In which you have to create:


  1. A structure (using struct keyword) named StudentProfie.
  2. A class named ArrayList.




StudentProfile structure must have five variables of type string (string.h library) in it.

  1. userid
  2. userName
  3. subject
  4. degreeProgram
  5. uniName


ArrayList should implement following data members and member functions:


Data Members



Declare an array of type StudentProfile.


Declare an integer variable used to store array index value we are currently working with.


Declare an integer variable to store the size of the list.




Add student profile record in the array list at position in which we want to add it like 0,1,2,3,4,5… in the list.

e.g. arrList.add(studentProfile1,5) while arrList is an object of ArrayList class and position is 5.


Find particular student profile in the array list.

e.g. arrList.find(testStdProfile).


Update student profile record at a given position in the array list.

e.g. arrList.update(stdProfile1,2).

remove (?)

Remove student profile record from the given position in the array list.

e.g. arrList.remove(1).


Return size of list. (Not array size)

e.g. arrList.listLength().


Will show the list data as given in below screenshots (Detailed Output Screenshot).

e.g. arrList.showList().


Will compare two student profiles if they are same or not.

e.g. comStdRec(stdProfile1,stdProfile2).


(“X” denote StudentProfie Object means a student profile record while “?” denotes position where want to add a particular record in the array list.)

In the main() function you have to:


1.      Create five object of type StudentProfie at first five positions and then add all of them in the array list by using add(X,?) method of ArrayList.

2.      Then you have to find 4th student profile using find(X) method.

3.      Update 4th student profile using update(X,?) method and set it same as 1st student profile record.

4.      Remove 4th student profile using remove(X) method.

5.      At last show the length of array list using listLength() method.

6.      For first four steps you have to call showList() method to show list data after calling each function like given in the below screenshots.


Note: First student profile record should be your own data.

For Example:

If your id is BC123456789, name as Bilal, Subject CS301, Degree BSCS and University VU. Then this student profile record must store at first position in the list like given in the screenshot.

Detailed Output Screenshot:

Main Output Screenshot:

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

See Your Saved Posts Timeline

Views: 2799


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

Discussed & be touched with this discussion. After discussion a perfect solution will come in a result at the end.


“How to Join Subject Study Groups & Get Helping Material”


P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Dear Students Don’t wait for solution post your problems here and discuss ... after discussion a perfect solution will come in a result. So, Start it now, replies here give your comments according to your knowledge and understandings....

sir plz solution send kr dain plz plz plz plz

salam sir solution??for cs 301

salam rspected sir plz sloution for cs301 plzplzplzplz

Anyone koi solution bhej skta hai mjy arraylist m add krna nhi ara yar ... I have only use struct and it is only giving the id name  uniname and degreeprogram ... Koi bta dai kay arraylist m add kesy krna hai sab aur phr arraylist m different methods kesy lagny hain


#include <iostream>
#include <string.h>
using namespace std;


struct StudentProfile{
string userid;
string userName; 
string subject; 
string degreeName; 
string uniName; 


class ArrayList{
StudentProfile * arr; 
int current; 
int listSize; 
void add(StudentProfile student); 
StudentProfile find(int x); 
void update(int postition, StudentProfile student);
void remove(int x); 
int listLenght(); 
void showList();
void cmpStdRec(StudentProfile x, StudentProfile y);
arr = new StudentProfile [10]; 
listSize = 0 ; 
current = 0; 
void ArrayList::add(StudentProfile x){
arr[listSize] = x ; 
current = listSize; 
StudentProfile ArrayList::find(int x){
return arr[x];
void ArrayList::update(int position, StudentProfile student){
arr[position] = student;
void ArrayList::remove(int x){
arr[x].userid = ""; 
listSize--; // listSize = listSize - 1; 
int ArrayList::listLenght(){
return listSize;
void ArrayList::showList(){
cout "Sr ID Name Subject Deg Uni " endl ; 
int SrNo = 1 ; 
for(int i = 0 ; i <= listSize; i++){
if(arr[i].userid != ""){
cout SrNo " " arr[i].userid " " arr[i].userName " " arr[i].subject " " arr[i].degreeName " " arr[i].uniName endl;
delete []arr; 
int main(){
ArrayList StudentArray; 
StudentProfile std1, std2 , std3, std4, std5 ; 
// Student 1 
std1.userid = "MC180400224" ;
std1.userName = "Ali" ; 
std1.subject = "CS301" ; 
std1.degreeName = "MCS"; 
std1.uniName = "VU";
// Student 2
std2.userid = "MC1807678890" ;
std2.userName = "Naeem" ; 
std2.subject = "CS301" ; 
std2.degreeName = "MCS"; 
std2.uniName = "VU";
// Student 3 
std3.userid = "MC180401444" ;
std3.userName = "khuram" ; 
std3.subject = "CS301" ; 
std3.degreeName = "MCS"; 
std3.uniName = "VU";
// Student 4
std4.userid = "MC180607997" ;
std4.userName = "haris" ; 
std4.subject = "CS301" ; 
std4.degreeName= "MCS"; 
std4.uniName = "VU";
// Student 5
std5.userid = "MC180477788" ;
std5.userName = "awais" ; 
std5.subject = "CS301" ; 
std5.degreeName= "MCS"; 
std5.uniName = "VU";




// Finding the Record


cout "\nFinding the record at position 4" endl; 
StudentProfile found = StudentArray.find(3); 
cout "Student Found At position 4 is having the ID: " found.userid endl ; 
//update the record


cout"\nupdate the record at position 4" endl;


std4.userid = " MC180607997"; 
std4.userName = "haris" ; 
std4.subject = "CS301" ; 
std4.degreeName = "MCS"; 
std4.uniName = "VU";
StudentArray.update(3, std4); 


// removing the record


cout "\nRemove the 4th Student Record " endl ;




cout "\nlenght of the Array List: " StudentArray.listLenght() endl ;



salam sir is it compelete solution

this has a lot of errorss

Dear Students Don’t wait for solution post your problems here and discuss ... after discussion a perfect solution will come in a result. So, Start it now, replies here give your comments according to your knowledge and understandings....

Share below link with friends for solution & Discussion.



Latest Activity

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service