Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FirstProgramm.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include <iomanip>
- #include <iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- using std::string;
- using std::setprecision;
- using std::fixed;
- int main()
- {
- char book[256];
- int books;
- int count = 0;
- bool doesExist = false;
- cin.getline(book, 256);
- cin >> books;
- cin.ignore();
- cout;
- while (books > 0)
- {
- char checkedBook[256];
- cin.getline(checkedBook, 256);
- if (checkedBook == book)
- {
- doesExist = true;
- break;
- }
- books--;
- count++;
- }
- if (doesExist == false)
- {
- cout << "The book you search is not here!" << endl;
- cout << "You checked " << count << " books.";
- }
- else
- {
- cout << "You checked " << count << " books and found it." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement