Using only include include include include Write a program t

Using only
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
Write a program to read the parts .txt file and display the cost of inventory for each of the part classes. The file contains parts of class A, B, C and D. Atypical line in the file would be: P-11191 A 10 34.29 This is part number P-11191, a class A part, of which there are 10 in stock and each costs $34.29. Your program, therefore, would add 342.90 to class A inventory. C: Windows system321cmd.exe .....................INUENTORY REPORT A parts Count 85 Value of inventory 191180.07 69 Value of inventory 74764.16 B parts Count C parts Count: 76 Value of inventory 49506.06 D parts Count 61 Value of inventory 22738.69 Unknown Count 13 Value of inventory: 4282.68 Press any key to continue

Solution

#include #include #include #include using namespace std; int main() { string classId[30], classType[30], stock[30], cost[30]; ifstream myfile(\"../test.txt\"); int id = 0, types = 0, st = 0, cst = 0; if(!myfile) { cout<<\"Error opening output file\"<0){ for(inc=0; inc> stock1; stringstream geek2(cost[inc]); geek2 >> cost1; inventory = stock1 * cost1; cout << classType[inc] << \" Parts Count: \" << stock[inc] << \" Value of inventory: \" << (double)inventory << \"\ \"; } } } Sample Output: A Parts Count: 10 Value of inventory: 344.3 B Parts Count: 25 Value of inventory: 1112.5 C Parts Count: 45 Value of inventory: 541.035 test.txt input file: P-1191 A 10 34.43 P-1192 B 25 44.5 P-1193 C 45 12.023
Using only #include <iostream> #include <fstream> #include <string> #include <iomanip> Write a program to read the parts .txt file and d

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site