Write a C program that takes inventory data from a file and loads a structure of up to 100 items
defined as:
struct item
{
int item_number;
char item_name[20];
char item_desc[30];
float item_price;
}
I called mine: struct item inventory[100]; (you may use any name you wish)
I will let you decide the appropriate prompts and edit messages. You will read the data
from the data file and store the info in an array. Assume no more than 100 records will
be in the data file. You may use the data below for testing purposes with the attached
file.
Once the program opens the file, and reads the data into the array, the program should
then give the user the option to SORT THE DATA IN ASCENDING ORDER BY ITEM
NUMBER, OR ITEM NAME OR ITEM DESC, OR ITEM PRICE, and output the
inventory data in report form of your design with alignment, or exactly as follows below.
The report will also be directed to an output text file (named report7.txt) with the same
output as printed to the screen.
Hints/requirements:
• Program without sort options is a 10 point deduction.
• Program with no output to invreport.txt is a 10 point deduction
• Without current date and time stamp is a 5 point deduction
• No data validation is required (assume it was validated before writing to the file)
• To Simplify your work I did not use any ‘white-space’ in the descriptions
• You must open the file in r mode such as: in_file_ptr = fopen(file_name, "r")
• I read the file: fscanf(in_file_ptr, "%i", &inventory[x].item_number); /* etc. */
The sample data file contains data similar to the following (in a text file)
Write a C program that takes inventory data from a file and loads a structure of up to 100 items ...
please write in C++ Write a program that uses a structure to store the following inventory data in a file: The data can be either read from a text file or the keyboard Item name (string) Quantity on hand(int) Wholesale cost(double) Retail Cost(double) The program should have a menu that allows the user to perform the following tasks: Add new records to the file Display any record in the file User will provide the name of the item or the...
Write a program that will take input from a file of numbers of type double and output the average of the numbers in the file to the screen. Output the file name and average. Allow the user to process multiple files in one run. Part A use an array to hold the values read from the file modify your average function so that it receives an array as input parameter, averages values in an array and returns the average Part...
Inventory Program (C++) Write a program that uses a structure to store the following inventory data in a file: - Item Description -Quantity on Hand -Wholesale cost -Retail cost -Date Added to Inventory The program should have a menu that allows the user to perform the following tasks: -Add new records to file -Display any record in the file -Change any record in the file Input Validation: The program should not accept quantities, or wholesale or retail costs, less than...
The name of the C++ file must be search.cpp Write a program that will read data from a file. The program will allow the user to specify the filename. Use a loop that will check if the file is opened correctly, otherwise display an error message and allow the user to re-enter a filename until successful. Read the values from the file and store into an integer array. The program should then prompt the user for an integer which will...
using c 3 File Input & Data Processing Reading data from a file is often done in order to process and aggregate it to get ad- ditional results. In this activity you will read in data from a file containing win/loss data from the 2011 Major League Baseball season. Specifically, the file data/mlb_nl_2011.txt contains data about each National League team. Each line contains a team name fol- lowed by the number of wins and number of losses during the 2011...
C++ 3. Write a program that reads integers from a file, sums the values and calculates the average. a. Write a value-returning function that opens an input file named in File txt. You may "hard-code" the file name, i.e., you do not need to ask the user for the file name. The function should check the file state of the input file and return a value indicating success or failure. Main should check the returned value and if the file...
C++ Write a program that keeps track of inventory The data is located in the file Inventory.txt. While the program is running, the information should be stored in a linked list. The information for each item needs be stored in a struct The definition will be in a separate file called items.h The total inventory will be stored in a linked list The definition of the list class will be in a file called linkList.h The program should be able...
The following is a sample inventory in C++, i want to ask the user to input a item number for removing from inventory. //CPP #include <iostream> #include <fstream> #include <cstdlib> #include <iomanip> #define MAX 1000 using namespace std; //Function to Add a new inventory item to the data into the array in memory void addItem(string desc[],string idNum[], float prices[], int qty[],int &num) { cout<<"Enter the names:"; cin>>desc[num]; cout<<"Enter the item number:"; cin>>idNum[num]; cout<<"Enter the price of item:"; cin>>prices[num]; cout<<"Enter the...
In C++ Write a menu driven C++ program to read a file containing information for a list of Students, process the data, then present a menu to the user, and at the end print a final report shown below. You may(should) use the structures you developed for the previous assignment to make it easier to complete this assignment, but it is not required. Required Menu Operations are: Read Students’ data from a file to update the list (refer to sample...
C++ Data Structure Write a program to read a list of students from a file and create a list. The program should use a linked list for implementation. Each node in the linked list should have the student’s name, a pointer to the next student, and a pointer to a linked list of scores. There may be up to four scores for each student.