Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <array>
- #include <string>
- #include <fstream>
- using namespace std;
- ifstream inFile;
- ofstream outFile;
- const int fileSize = 50;
- bool cont = true;
- char option;
- int counter;
- struct Household {
- string id;
- int income;
- int members;
- }household[fileSize];
- int main() {
- inFile.open("C:\\Users\\jjooe\\Desktop\\Test Data File for Lab 8A.txt");
- if (!inFile) {
- cout << "Error. Could not open file." << endl;
- system("pause");
- return 1;
- }
- for (int i = 0; i < fileSize; i++) {
- inFile >> household[i].id;
- inFile >> household[i].income;
- inFile >> household[i].members;
- }
- while (cont == true) {
- cout << "Enter a capital letter A-E to choose the option you want." << endl << endl;
- cout << "A. Display all of the household data." << endl;
- cout << "B. Dispaly the average household income and list the identification codes and income of each household whose income is greater than the average." << endl;
- cout << "C. Display the percentage of households having an income below the poverty level." << endl;
- cout << "D. Display all of the input data sorted by household income." << endl;
- cout << "E. Display the median household income." << endl;
- cin >> option;
- if (option == 'A') {
- }
- }
- }
- void getData(Household input[], int& counter) {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement