preview

Artificial Intelligence : A Modern Approach

Decent Essays

#include #include #include using namespace std; string bookTitle[] = {"Starting out with C++", "Java Programming", "Software Structures", "Design and Analysis of Algorithms", "Computer Graphics", "Artificial Intelligence: A Modern Approach", "Probability and Statistics", "Cognitive Science", "Modern Information Retrieval", "Speech and Language Processing"}; int bookID[] = {1101, 1211, 1333, 1456, 1567, 1642, 1699, 1755, 1800, 1999}; double bookPrice[] = {112.32, 73.25, 54.00, 67.32, 135.00, 173.22, 120.00, 42.25, 32.11, 123.75}; void display(); void buyBook(int); int menu(); int linearSearch(); int binarySearch(); int bubbleSort(); int selectionSort(); int main() { int choice = 0; bool quit = false; while (choice != 5) { cout << "Select one of the following options:" << endl; cout << "1. Linear Search 2. Binary Search 3. Bubble Sort 4. Selection Sort 5. Quit "; cin >> choice; switch (choice) { case 1: buyBook(linearSearch()); break; case 2: buyBook(binarySearch()); break; case 3: bubbleSort(); break; case 4: selectionSort(); break; case 5: break; default: cout << "Invalid Input. Please Try Again." << endl << endl; } } } void display() {

Get Access