We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

# CS301 Assignment No 01 Spring 2020 Solution & Discussion

CS301 Assignment No 01 Spring 2020 Solution & Discussion

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

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

Views: 1834

### Replies to This Discussion

Our main purpose here discussion not just Solution

Students having same subject can start discussion here to solve assignment, GDB & Quiz and can clear their concepts until solution is provided.

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

Then copy Questions from assignment file and paste in Discussion.

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

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

CS301_Assignment_No_01_Solution_Spring_2020

CS301_Assignment_No_01_Solution_Spring_2020

***

# CS301 Data Structure Assignment No. 1 Solution

You are required to write a program in C++ to implement Stack data structure and use this data structure to store different types of books based on their identity number. You have to implement Stack data structure using array. A stack is a LIFO structure in which data elements are stored in an order such that last element pushed on the stack will be popped up first. Your program should cover the following scenario. Suppose a student is collecting books and throwing them into stack of books. You need to develop an application that will count different books in the stack. This stack will consist of three types of books i.e. software, hardware and other books. You will identify book with unique numeric identity number. If book identity number will fully dividable by 8, will consider it software book. While the number fully dividable by 5 will consider it hardware book and consider rest of the books as other books. First, the program will ask the user to input size of the stack. Then the programmer will ask the user to input total number of books. Then according to the number of Books, it will ask the user to enter identity number for each book. The book identity number can be any random number between 1 and 99. If book identity number is fully dividable by 8, we will consider it software book. While the number fully dividable by 5 will consider it hardware book and consider rest of the books as other books. Programmer should implement isFull() function of the stack to check if the number of books exceed the size of the stack and isEmpty() function to check if the stack is empty or not. Programmer should also display the message “Books not found” if no books found. Solution Guidelines: 1. First understand the code given in handouts about stack. 2. Get stack size from user to allocate space for stack dynamically. 3. Get identity number of books that user want to enter into the stack. 4. Get value one by one and push into stack. 5. Don’t allow popping if stack is empty and pushing if stack is full. 6. If identity number of book is dividable by 8 and 5 then priority should be given to 8.

#CS301
#CS301Assignment
#DataStructure
#VU
#VUAssignment
#AssignmentSolution
#VUAssignment2020
#CS301Assignment2020

Sir me ny assignment ki but iss main error aa Raha hai

Error ka screenshot share kren.

# CS301 Data Structure Assignment No. 1 Solution

Dear Students I have Solved and Uploaded the Assignment of CS301. I have also tried to explain it to you.

The biggest issue that comes up when submitting an assignment is copy paste.

To fix this, I have explained in video how we can save copy paste issue by how to do that change in code / assignment.

CS301 Data Structure Assignment No. 1 Solution

You are required to write a program in C++ to implement Stack data structure and use this data structure to store different types of books based on their identity number. You have to implement Stack data structure using array. A stack is a LIFO structure in which data elements are stored in an order such that last element pushed on the stack will be popped up first.
Your program should cover the following scenario.
Suppose a student is collecting books and throwing them into stack of books. You need to develop an application that will count different books in the stack. This stack will consist of three types of books i.e. software, hardware and other books.
You will identify book with unique numeric identity number. If book identity number will fully dividable by 8, will consider it software book. While the number fully dividable by 5 will consider it hardware book and consider rest of the books as other books.

First, the program will ask the user to input size of the stack. Then the programmer will ask the user to input total number of books. Then according to the number of Books, it will ask the user to enter identity number for each book. The book identity number can be any random number between 1 and 99. If book identity number is fully dividable by 8, we will consider it software book. While the number fully dividable by 5 will consider it hardware book and consider rest of the books as other books.

Programmer should implement isFull() function of the stack to check if the number of books exceed the size of the stack and isEmpty() function to check if the stack is empty or not. Programmer should also display the message “Books not found” if no books found.

Solution Guidelines:
1. First understand the code given in handouts about stack.
2. Get stack size from user to allocate space for stack dynamically.
3. Get identity number of books that user want to enter into the stack.
4. Get value one by one and push into stack.
5. Don’t allow popping if stack is empty and pushing if stack is full.
6. If identity number of book is dividable by 8 and 5 then priority should be given to 8.

#CS301
#CS301Assignment
#DataStructure
#VU
#VUAssignment
#AssignmentSolution
#VUAssignment2020
#CS301Assignment2020

# cs301 assignment 1 SOLUTION 2020 spring Correct solved Complete

CS301 Assignment 1 Complete Solution Spring 2020,CS301 Assignment 1 Complete Solution,CS301 Assignment 1,CS301,CS301 assignment 1 solution,CS301 assignment spring 2020,CS301 assignment solution spring 2020,CS301 assignment, assignment 1 CS301 solution, solution CS301 assignment 1, Cs301 assignment 1 solution 2020,Cs301 assignment solution 2020,Cs301 assignment 1,Cs301 assignment 1 solution spring 2020,Cs301 assignment no 1 solution spring 2020,Cs301 assignment no 1 solution 2020,Cs301 1st assignment solution 2020,Cs301 1st assignment solution,Cs301 1st assignment solution spring 2020,assignment solution spring 2020,CS301 Assignment 1 Complete Solution Spring 2020,CS301 Assignment 1 Complete Solution,CS301 Assignment 1,CS301,CS301 assignment 1 solution,CS301 assignment spring 2020,CS301 assignment solution spring 2020,CS301 assignment,assignment 1 CS301 solution,solution CS301 assignment 1

CS301_Assignment_No_01_Solution_Spring_2020

CS301_Assignment_No_01_Solution_Spring_2020

Solution of Cs301 Assignment No 1

Solution of Cs301 Assignment No 1

CS301 Data Structures Assignment 1 Solution & Discussion Spring 2020

CS301 Solution Idea:

`//student id Bc170403888// student name Faizan Nadeem#include<iostream>using namespace std;class MYBooks{ private : int current; int books; int size; int *stack; public : MYBooks(int s, int b) {size=s; stack= new int[size]; books=b; current=-1; } void push(int x){ // -1 +1=0 stack[++current]=x;}int pop(){ return stack[current--];}int top() { return stack[current]; } int isEmpty() { return (current==-1); } int isFull() { //5 4 return (current==size-1); } }; main(){  int s, b, id; int s_books=0, h_books=0, o_books=0; cout"set the size of stack : "; cin>>s; coutendl; cout"Number of books you want to add in stack : "; cin>>b; MYBooks book(s,b); //b =5 for(int i=0; i<b; i++) { if(!book.isFull()) { coutendl; cout"Enter book id number that you want to insert into stack :"; cin>>id; book.push(id); } }  for(int i=0; i<b; i++) { if(!book.isEmpty()) { int idd=book.pop();  if(idd%8==0) { s_books++; } else if (idd%5==0) { h_books++; } else { o_books++; } } } if(b>0) { coutendl; cout"Total Software Books : "s_books; coutendl; cout"Total Hardware Books : "h_books; coutendl; cout"Total Other Books : "o_books; } else { coutendl; cout"Books not found"; } }`

## Latest Activity

+!!! Walker'\$ Inception!!! liked ARhum's discussion Poetry...!!!
2 minutes ago
+M.Tariq Malik liked CristinaPerry's discussion Organic Carpet Cleaning
11 minutes ago
Muskan Ch updated their profile
28 minutes ago
Jimmy007 updated their profile
49 minutes ago
CristinaPerry posted a discussion

51 minutes ago
1 hour ago

1

2