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

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

View Full Document Right Arrow Icon
//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;
Background image of page 1

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

View Full DocumentRight Arrow Icon
} 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);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/18/2008 for the course COS 220 taught by Professor Roberts during the Spring '08 term at University of Maine Orono .

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 Right Arrow Icon
Ask a homework question - tutors are online