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

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

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

#include <iostream>#include <iostream>#include <stdlib.h>#include <string.h>
using namespace std;// struct define here struct student{ int bookID; char title[50]; char authorofBook[50]; int costofBook;};
// initialize books with 5 numberconst int noofBooks = 5;int arrindex = 0;
// create object of student which is struct student studentobj[noofBooks];
// add books function herevoid Add_Book(){ if(arrindex < noofBooks){ cout "***Enter the Details of Books***"endl; cout "Enter a book id"; cin >> studentobj[arrindex].bookID; cout "Enter book Title"; cin >> studentobj[arrindex].title; cout "Enter the name of author"; cin >> studentobj[arrindex].authorofBook; cout "Enter the cost of Book"; cin >> studentobj[arrindex].costofBook; arrindex++;}else{ cout "No more space in system for another book";} }
// display books functions herevoid Display_Books(){ for(int i = 0; i < arrindex; i++){ cout "***Details of all books in library ***"endl; cout "book id " studentobj[i].bookID endl; cout "Book Title is " studentobj[i].title endl; cout "Author name " studentobj[i].authorofBook endl; cout "Cost of Book" studentobj[i].costofBook endl; }
}
// search books by author name function here void Book_Author(){ char search_book[30]; cout "Enter the name of  Author: " endl; cin >> search_book; for(int i = 0; i < arrindex; i++){ if(strstr(search_book,studentobj[i].authorofBook)){ cout endl; cout "Book id is : " studentobj[i].bookID endl; cout "Book Title is :" studentobj[i].title endl; cout "Author Name is " studentobj[i].authorofBookendl; cout "Cost of Books :"studentobj[i].costofBookendl; }else{ cout "No Record Found"endl; } }}
// here is main programint main(){ int choice; char input; do{ cout "***Library Book Record  System***" endl; cout "Press 1 To Enter a Book Record"endl; cout "Press 2 To Display All Records of Books available in library"endl; cout "Press 3 To Search Books by Author Name"endl; cout "Press 4 To Count Total Books in Library"endl; cout "Press 5 To Exit from the System"endl; cout "Enter the Choice"endl; cin >> choice; switch(choice){ case 1: Add_Book(); break; case 2: Display_Books(); break; case 3: Book_Author(); break; case 4: cout "Total number of books in library are :" arrindex endl; break; case 5: exit(0); default: cout "invalid Choice Please try again!"; } cout "Are you want to continue, Please press y or  Y"endl; cin >> input;
}while(input=='Y' || input == 'y'); }

+ 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: 1257

.

+ 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

solution in file

Attachments:
It doesn't meet the requirements of the assignment.

if this is wrong can u give me exact solution please.

This may be fine but you don't used strcmp() function

 But strcmp() should be used according to given assignment file.

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

struct book{
int book_Id;
string book_Title;
string book_Author;
int book_Cost;
};
book libraryp[5];
int arrayposition=0;
void addbooks(){
book bookdetail;
cout"Enter the book id: "endl;
cin>>bookdetail.book_Id;
cout"Enter the book Title:"endl;
cin>>bookdetail.book_Title;
cout"Enter the book author:"endl;
cin>>bookdetail.book_Author;
cout"Enter the book price:"endl;
cin>>bookdetail.book_Cost;
libraryp[arrayposition]=bookdetail;
arrayposition++;

}
void displaybooks(){
for(int i=0; i<5; i++){
book displayitem=libraryp[i];
if(displayitem.book_Id!=0){

cout"book id is :"displayitem.book_Idendl;
cout"book Title is :"displayitem.book_Titleendl;
cout"book author is :"displayitem.book_Authorendl;
cout"book cost is :"displayitem.book_Costendl;
}
}
}
void book_author(){
string searchauthor;
cin >> searchauthor;
for(int i=0; i<5; i++){
book displayitem=libraryp[i];

string s =searchauthor;
int n = s.length();
char author[n + 1];
strcpy(author, s.c_str());

string st =displayitem.book_Author;
int ln = st.length();
char bookauthor[ln + 1];
strcpy(bookauthor, st.c_str());

if(strcmp(author,bookauthor)==0){
cout"book id is : "displayitem.book_Idendl;
cout"book Title is : "displayitem.book_Titleendl;
cout"book author is: "displayitem.book_Authorendl;
cout"book cost is : "displayitem.book_Costendl;
}
}

}
void count_book(){
int count=0;
for(int i=0; i<5; i++){
book displayitem=libraryp[i];
if(displayitem.book_Id!=0){
count++;
}
}
cout "Total No of books in library: "countendl;
}

int main()
{
while(true){
cout" ********Library Record System*******"endl;
cout"press 1 to enter book record."endl;
cout"press 2 to Display all record available in library."endl;
cout"press 3 to Search Books by Author Name."endl;
cout"press 4 Count Total Books in Library."endl;
cout"press 5 Exit from the System."endl;
cout"Enter Choise: "endl;
int choise;
cin>>choise;
switch(choise){
case 1:
addbooks();
break;
case 2:
displaybooks();
break;
case 3:
book_author();
break;
case 4:
count_book();
break;
case 5:
exit(0);
}
}

cin.get();
}

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: ___________”

 

Share below link with friends for solution & Discussion. A Single link for help in your education.

http://bit.ly/vucodes

 

Site Overview | Assignment Solutions | Past Papers |Site Features

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

struct book{
int book_Id;
string book_Title;
string book_Author;
int book_Cost;
};
book libraryp[5];
int arrayposition=0;
void addbooks(){
book bookdetail;
cout"Enter the book id: "endl;
cin>>bookdetail.book_Id;
cout"Enter the book Title:"endl;
cin>>bookdetail.book_Title;
cout"Enter the book author:"endl;
cin>>bookdetail.book_Author;
cout"Enter the book price:"endl;
cin>>bookdetail.book_Cost;
libraryp[arrayposition]=bookdetail;
arrayposition++;

}
void displaybooks(){
for(int i=0; i<5; i++){
book displayitem=libraryp[i];
if(displayitem.book_Id!=0){

cout"book id is :"displayitem.book_Idendl;
cout"book Title is :"displayitem.book_Titleendl;
cout"book author is :"displayitem.book_Authorendl;
cout"book cost is :"displayitem.book_Costendl;
}
}
}
void book_author(){
string searchauthor;
cin >> searchauthor;
for(int i=0; i<5; i++){
book displayitem=libraryp[i];

string s =searchauthor;
int n = s.length();
char author[n + 1];
strcpy(author, s.c_str());

string st =displayitem.book_Author;
int ln = st.length();
char bookauthor[ln + 1];
strcpy(bookauthor, st.c_str());

if(strcmp(author,bookauthor)==0){
cout"book id is : "displayitem.book_Idendl;
cout"book Title is : "displayitem.book_Titleendl;
cout"book author is: "displayitem.book_Authorendl;
cout"book cost is : "displayitem.book_Costendl;
}
}

}
void count_book(){
int count=0;
for(int i=0; i<5; i++){
book displayitem=libraryp[i];
if(displayitem.book_Id!=0){
count++;
}
}
cout "Total No of books in library: "countendl;
}

int main()
{
while(true){
cout" ********Library Record System*******"endl;
cout"press 1 to enter book record."endl;
cout"press 2 to Display all record available in library."endl;
cout"press 3 to Search Books by Author Name."endl;
cout"press 4 Count Total Books in Library."endl;
cout"press 5 Exit from the System."endl;
cout"Enter Choise: "endl;
int choise;
cin>>choise;
switch(choise){
case 1:
addbooks();
break;
case 2:
displaybooks();
break;
case 3:
book_author();
break;
case 4:
count_book();
break;
case 5:
exit(0);
}
}

cin.get();
}

Solution of Cs201 Assignment no 3

Attachments:

Cs201 Assignment no 3

Attachments:

#cs201 assignment no 3

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

struct book{
int book_Id;
string book_Title;
string book_Author;
int book_Cost;
};
book libraryp[5];
int arrayposition=0;
void addbooks(){
book bookdetail;
cout"Enter the book id: "endl;
cin>>bookdetail.book_Id;
cout"Enter the book Title:"endl;
cin>>bookdetail.book_Title;
cout"Enter the book author:"endl;
cin>>bookdetail.book_Author;
cout"Enter the book price:"endl;
cin>>bookdetail.book_Cost;
libraryp[arrayposition]=bookdetail;
arrayposition++;

}
void displaybooks(){
for(int i=0; i<5; i++){
book displayitem=libraryp[i];
if(displayitem.book_Id!=0){

cout"book id is :"displayitem.book_Idendl;
cout"book Title is :"displayitem.book_Titleendl;
cout"book author is :"displayitem.book_Authorendl;
cout"book cost is :"displayitem.book_Costendl;
}
}
}
void book_author(){
string searchauthor;
cin >> searchauthor;
for(int i=0; i<5; i++){
book displayitem=libraryp[i];

string s =searchauthor;
int n = s.length();
char author[n + 1];
strcpy(author, s.c_str());


string st =displayitem.book_Author;
int ln = st.length();
char bookauthor[ln + 1];
strcpy(bookauthor, st.c_str());

if(strcmp(author,bookauthor)==0){
cout"book id is : "displayitem.book_Idendl;
cout"book Title is : "displayitem.book_Titleendl;
cout"book author is: "displayitem.book_Authorendl;
cout"book cost is : "displayitem.book_Costendl;
}
}

}
void count_book(){
int count=0;
for(int i=0; i<5; i++){
book displayitem=libraryp[i];
if(displayitem.book_Id!=0){
count++;
}
}
cout "Total No of books in library: "countendl;
}

int main()
{
while(true){
cout" ********Library Record System*******"endl;
cout"press 1 to enter book record."endl;
cout"press 2 to Display all record available in library."endl;
cout"press 3 to Search Books by Author Name."endl;
cout"press 4 Count Total Books in Library."endl;
cout"press 5 Exit from the System."endl;
cout"Enter Choise: "endl;
int choise;
cin>>choise;
switch(choise){
case 1:
addbooks();
break;
case 2:
displaybooks();
break;
case 3:
book_author();
break;
case 4:
count_book();
break;
case 5:
exit(0);
}
}

cin.get();
}

CS201 Assignmen_03_Solution

Attachments:

RSS

Latest Activity

彡JK彡 ❤️ replied to +"Certified Gangster"++'s discussion Hosla
51 minutes ago
彡JK彡 ❤️ replied to +++Mahoo+++'s discussion apko chun lia jata ha
53 minutes ago
Shine--Ex-VUStudent liked + sílєnzíσ's discussion If fb, google nd youtube would have been subjects..... !!!!!!!!!!!!
54 minutes ago
Biya replied to Biya's discussion Ehsaas...
54 minutes ago
彡JK彡 ❤️ replied to + ! ❤INNOCENT❤'s discussion Akhri Salam Smjh kr
55 minutes ago
彡JK彡 ❤️ replied to + !! SARAH's discussion + i dnt knw where it could fit into ur story but it is......!!
58 minutes ago
彡JK彡 ❤️ replied to + !! SARAH's discussion + i dnt knw where it could fit into ur story but it is......!!
59 minutes ago
彡JK彡 ❤️ replied to Biya's discussion Ehsaas...
1 hour ago
彡JK彡 ❤️ replied to +¢αяєℓєѕѕ gιяℓ's discussion True.....
1 hour ago
彡JK彡 ❤️ replied to + ! ! ! ! Noor E Kayenat's discussion Please Raise Ur Hand !!
1 hour ago
彡JK彡 ❤️ replied to Biya's discussion Aurat Bari Piyari Cheez Hai.. :D
1 hour ago
彡JK彡 ❤️ replied to + Iuuoɔǝut+'s discussion koi asa shaks hua kare ....
1 hour ago
Biya updated their profile
1 hour ago
彡JK彡 ❤️ replied to Whispering Soul's discussion Kabi kabi...
1 hour ago
彡JK彡 ❤️ replied to + !! SARAH's discussion hahhahahahaha!!!!!!
1 hour ago
彡JK彡 ❤️ replied to + !ѕιмρℓє ¢н's discussion choti choti khwahishein....
1 hour ago
彡JK彡 ❤️ replied to + Iuuoɔǝut+'s discussion Mind blowing mehndi design ...
1 hour ago
彡JK彡 ❤️ replied to + Iuuoɔǝut+'s discussion Mind blowing mehndi design ...
1 hour ago
Siddiq khan kakar replied to Siddiq khan kakar's discussion bssss
1 hour ago
彡JK彡 ❤️ replied to + "αяsαℓ " Ќąƶµяɨ •"'s discussion Dedicated to All teachers
1 hour ago

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

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