1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
#include <fstream>
#include <iostream>
#include <iomanip>
#include <conio.h>
using namespace std;
//prototype
void display ();
//int fac1_1, fac1_2, fac1_3, fac1_4, fac2_1, fac2_2, fac2_3, fac2_4, fac3_1, fac3_2, fac3_3, fac3_4, fac4_1, fac4_2, fac4_3, fac4_4;
//the array
int factory[3][5]; // {
// {fac1_1, fac1_2, fac1_3, fac1_4},
// {fac2_1, fac2_2, fac2_3, fac2_4},
//{fac3_1, fac3_2, fac3_3, fac3_4},
// {fac4_1, fac4_2, fac4_3, fac4_4}
//
int main()
{
int choice;
bool again = true;
while (again)
{
//system("cls");
cout << "1 to display all factories and shifts production runs ";
cout << "\n2 to displya highest and lowest production runs " ;
cout << "\n3 Display the average of a factory and shift ";
cout << "\n4 Manually change the production numbers ";
cout << "\n5 quit ";
cout << "\nwhat would you like to do? ";
cin >> choice;
switch (choice)
{
case 1:
{
cout << "Yay";
display ();
getch();
break;
}
case 2:
{
cout << "2 yay";
break;
}
case 3:
{
break;
}
case 4:
{
break;
}
case 5:
{
//system("cls");
cout << "You have chosen to quit this program ";
again = false;
break;
}
}
}
}
void display()//change void instead?
{
//system("cls");//For me: only available with <cstdlib>, which isn't included
//http://www.cplusplus.com/reference/cstdlib/system/
cout << "You have choosen to see all the factories and their current production runs ";
//bringing in the file
ifstream inFile("FactoryData.txt", ios::in);
if (!inFile)
{
cout << "\nnot infile\n";
}
else
{
for(int y=0;y<6;y++)
{
for(int x=0;x<4;x++)
{
inFile >> factory[y][x];
cout<<"Factory ["<<y<<"]["<<x<<"]: "<<factory[y][x]<<endl;
}
}
}
inFile.close();
}
|