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
|
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <iostream>
using namespace std;
// This function will output a table back to the user of id's first and last names, and total before discount
void printCustomersData(const int id[], const string first[], const string last[], const double before_Discount[], int size);
// This function will just print id's, first and last names
void printNames(const int id[], const string first[], const string last[], int size);
// This function will print id's and the before discount and after discount costs
void printTotal(const int id[], const double before_Discount[], int size);
int main()
{
// initialize the variables I'll need
bool go = true;
int const size = 10;
int id[size];
string first[size];
string last[size];
double beforeDiscount[size];
int count = 0;
int i;
// open text file
ifstream fin;
fin.open("input.txt");
//make sure file is open
if (!fin)
{
cout << "Unable to open file." << endl;
exit(1);
return 0;
}
i = 0;
// putting information from file into the arrays
while (fin >> id[i] >> first[i] >> last[i] >> beforeDiscount[i])
{
i = i + 1;
}
while (go == true)
{
//output to user their options
cout << "1. Print all customers data \n2. Print names and Transaction ID\n3. Print total before and after discount applied\n4. Enter q/Q to quit\n\nPlease select an option, or press 'q' to quit." << endl;
char userInp;
cin >> userInp;
switch (userInp)
{
case '1':
printCustomersData(id, first, last, beforeDiscount, size);
break;
case '2':
cout << "case 2";
break;
case '3':
cout << "case 3";
break;
case 'q':
return 0;
break;
case 'Q':
return 0;
break;
default:
cout << "Sorry you've entered an incorrect input, please try again.\n\n";
break;
}
}
system("pause");
return 0;
}
void printCustomersData(const int id[], const string first[], const string last[], const double before_Discount[], int size)
{
int i;
i = 0;
cout << "ID" << endl;
for (i = 0; i <= 10; i++)
{
cout << id[i] << endl;
}
}
void printNames(const int id[], const string first[], const string last[], int size)
{
}
void printTotal(const int id[], const double before_Discount[], int size)
{
}
|