Question

C++ Help. I am new to Visual Studio and C++ so please include comments! Please follow...

C++ Help. I am new to Visual Studio and C++ so please include comments! Please follow the directions and make as simple as possible.

Write a C++ program that reads the following list of input data (book.dat) and then allows users to search and view the books from a Menu

List all available books

Search for book using A. Title or B. ISBN?

Exit Program

The format of the file is as follows:

//    The title of the book

//    The ISBN of the book

//    The Book Publisher

//    The year it was published

//    The authors of the book

//    The cost of the book

//    The number of copies of the book

//    The number of authors

//    List of Authors.

book.dat

C++Programing: From Problem Analysis to Program Design

5-17-525281-3

ABC

2000

52.50

20

1

Malik, D.S.

Fuzzy Discrete Structures

3-7908-1335-4

Physica-Verlag

2000

89.00

10

2

Malik, Davender

Mordeson, John

Fuzzy Mathematic in Medicine

3-7908-1325-7

Physica-Verlag

2000

89.00

10

3

Mordeson, John

Malik, Davender

Cheng, Shih-Chung

Harry John and The Magician

0-239-23635-0

McArthur A. Devine Books

1999

19.95

10

3

Goof, Goofy

Pluto, Peter

Head, Mark

Dynamic InterWeb Programming

22-99521-453-1

GNet

1998

39.99

25

1

Dimitri P. Bertsekas

Use the following functions in your program driver program.

      //Function Reads the input data file

void getBookData(BookType books[], int& noOfBooks);

//Function Displays the list of book information

void printBookData(BookType books[], int noOfBooks);

//Function Searches for book based on book title or ISBN

void searchBookData(BookType books[], int bookCount);

//Function searches list of books based on book ISBN and

//returns the location (index) of the found book.

void searchBookDataByISBN(BookType books[], int bookCount,        

                          string ISBN,int& loc);

//Function searches list of books based on book title and

//returns the location (index) of the found book.

void searchBookDataByTitle(BookType books[], int bookCount, string title, int& loc);

HINT: Define a class BookType with all the data members and member functions for accessing and setting the data members.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The code which I'm going to paste below, is running completely fine in visual studio.

=========================================CODE BEGINS===================================

#include <iostream>

#include <string>

using namespace std;

bool Palindrome(string s, int st, int en) {

if(st == en)

return 1;

//For skipping commas, spaces etc from forward.

if(st < en && isalnum(s[st]) == 0)

return Palindrome(s, st+1, en);

//For skipping commas, spaces etc from backward.

if(st < en && isalnum(s[en]) == 0)

return Palindrome(s, st, en-1);

//We character at st and en position matches.

if(toupper(s[st]) == toupper(s[en]))

return Palindrome(s, st+1, en-1);

//return false

return false;

}

int main() {

string word;

getline(cin, word);

cout<<Palindrome(word, 0, word.length()-1)<<endl;

system("pause");

return 0;

}

========================================CODE ENDS=====================================

The program is running completely fine on the given Input.

Note:- Please upvote if it has helped, otherwise, do comment on the part which yu don't like.

Thanks.

Add a comment
Know the answer?
Add Answer to:
C++ Help. I am new to Visual Studio and C++ so please include comments! Please follow...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I wrote this code but there’s an issue with it : #include <iostream> #include <vector&...

    I wrote this code but there’s an issue with it : #include <iostream> #include <vector> #include <string> #include <fstream> using namespace std; class Borrower { private: string ID, name; public: Borrower() :ID("0"), name("no name yet") {} void setID(string nID); void setName(string nID); string getID(); string getName(); }; void Borrower::setID(string nID) { ID = nID; } void Borrower::setName(string nname) { name = nname; } string Borrower::getID() { return ID; } string Borrower::getName() { return name; } class Book { private: string...

  • Using C programming (Microsoft Visual Studio) This is the code I have #include "pch.h" #include <iostream>...

    Using C programming (Microsoft Visual Studio) This is the code I have #include "pch.h" #include <iostream> #include <string.h> #include <stdlib.h> #include <stdio.h> #include<dos.h> #include <iostream> int id_arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; int pid_arr[] = { 0, 0, 0, 1, 13, 1, 2, 2, 5, 5, 5, 10, 4 }; char title_arr[][100] = { "Books & Audibles", "Electronics", "Food", "Books", "Science & Mathematics books", "Fictions", "Phones", "Appliances", "Astronomy", "Physics",...

  • Please provide original Answer, I can not turn in the same as my classmate. thanks In...

    Please provide original Answer, I can not turn in the same as my classmate. thanks In this homework, you will implement a single linked list to store a list of computer science textbooks. Every book has a title, author, and an ISBN number. You will create 2 classes: Textbook and Library. Textbook class should have all above attributes and also a “next” pointer. Textbook Type Attribute String title String author String ISBN Textbook* next Textbook Type Attribute String title String...

  • Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be...

    Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book tit le, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an...

  • Don't attempt if you can't attempt fully, i will dislike and negative comments would be given...

    Don't attempt if you can't attempt fully, i will dislike and negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book titnle, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an HTML web...

  • How to write the insert, search, and remove functions for this hash table program? I'm stuck......

    How to write the insert, search, and remove functions for this hash table program? I'm stuck... This program is written in C++ Hash Tables Hash Table Header File Copy and paste the following code into a header file named HashTable.h Please do not alter this file in any way or you may not receive credit for this lab For this lab, you will implement each of the hash table functions whose prototypes are in HashTable.h. Write these functions in a...

  • Objectives: The main objective of this assignment is checking students’ ability to implement membership functions. After...

    Objectives: The main objective of this assignment is checking students’ ability to implement membership functions. After completing this assignment, students will be able to:  implement member functions  convert a member function into a standalone function  convert a standalone function into a member function  call member functions  implement constructors  use structs for function overloading Problem description: In this assignment, we will revisit Assignment #1. Mary has now created a small commercial library and has managed...

  • C++ project we need to create a class for Book and Warehouse using Book.h and Warehouse.h header ...

    C++ project we need to create a class for Book and Warehouse using Book.h and Warehouse.h header files given. Then make a main program using Book and Warehouse to read data from book.dat and have functions to list and find book by isbn Objectives: Class Association and operator overloading This project is a continuation from Project 1. The program should accept the same input data file and support the same list and find operations. You will change the implementation of...

  • Here is what I got so far also can anyone help me align the output #include...

    Here is what I got so far also can anyone help me align the output #include <iostream> #include <iomanip> using namespace std; class Person { private: string name;    public: Person() { name = ""; } Person(string name) { this->name = name; } string getName() { return name; } void setName(string name) { this-> name = name; } }; class Publication { private: int pubNumber; string title; Person borrower;    public: static int count; Publication() { title = ""; }...

  • please Code in c++ Create a new Library class. You will need both a header file...

    please Code in c++ Create a new Library class. You will need both a header file and a source file for this class. The class will contain two data members: an array of Book objects the current number of books in the array Since the book array is moving from the main.cc file, you will also move the constant array size definition (MAX_ARR_SIZE) into the Library header file. Write the following functions for the Library class: a constructor that initializes...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT