Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string book;
- getline(cin, book);
- int bookCount, counter = 0;
- cin >> bookCount;
- cin.ignore();
- string command;
- getline(cin, command);
- for (int i = 0; i < bookCount && command != ""; i++) {
- if (command == "No More Books" || command == book) {
- break;
- }
- counter++;
- getline(cin, command);
- }
- if (command == book) {
- printf("You checked %i books and found it.\n", counter);
- }
- else {
- printf("The book you search is not here!\nYou checked %i books.\n", counter);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement