{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

C++HW6 - /Homework#5/This program will display a list of...

This preview shows pages 1–3. Sign up to view the full content.

//Homework #5 //This program will display a list of scores #include <iostream> #include <iomanip> #include <cmath> #include <fstream> using namespace std; struct inventory { int id; //ID code for product int stock; //Amount of product in stock double price; //Price of product }; int search(inventory a1[], int len, int target); int insert(inventory a1[], int &len, int extra); int remove (inventory a1[], int &len, int deleted); int display (inventory a1[], int len); int main () { ofstream fout; fout.open ( "output.txt" ); inventory a1[20]; ifstream fin; int len = 0; inventory temp; fin.open ( "inventory.txt" ); fin >> temp.id >> temp.stock >> temp.price; while (!fin.fail()) { a1[len] = temp; len++; fin >> temp.id >> temp.stock >> temp.price;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
} char choice; cout << "Enter S to search\n" ; cout << "Enter I to insert\n" ; cout << "Enter R to remove\n" ; cout << "Enter D to display inventory\n" ; cout << "Enter Q to quit\n" ; do { cin >> choice; if (choice == 's' || choice == 'S' ) { int searchid; cout << "Enter ID of product: " ; cin >> searchid; int item = search(a1, len, searchid);
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 7

C++HW6 - /Homework#5/This program will display a list of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online