summaryrefslogtreecommitdiff
path: root/CST116-lab3-SubmitFinal2-Bishop.cpp
blob: fdbd4657c33c0ec6156de9bcb4a7fbd258a48e0d (plain) (blame)
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
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
//William Bishop
//[email protected]

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

using std::cout;
using std::cin;
using std::endl;
int totals(int totalpeople)
int main()
{
    ofstream inFile;
    inFile.open("smaltext.txt");
    cout << "What is the name of the file we have?";
    ofstream file_("taxilogic.txt");
    inFile.open("taxilogic.txt");
    if (file_.is_open()) {
        file_ << "total fare = fare+toll \n";
        file_ << "Cost Per Mile = fare / distance\n";
        file_ << " Toll 1, 2, 3, 4 are: 4, 5, 7, 8. \n";
        file_ << " Fare 1, 2, 3, 4 are: 80, 15, 12, 13. \n";
        file_ << " Total Fare 1, 2, 3, 4 are: 84, 20, 19, 21 \n";
        file_ << "Mile rates are 15, 50, 40, 14, \n";
        file_ << " So the Cost per miles are: 5.333,.3,.3, .928 \n   ";
        in.close();
    }
    
    double totalfare1[4] = { 84, 15, 12, 13 };
    ofstream file_("totals.txt");
    inFile.open("totals.txt");
    if (file_.is_open()) {
        file_ << totalfare1 << endl;
        in.close();

    }
    std::cin.get();
    int totalpeople = 15;
    cout << totalfare1 << endl;
    int totals(int totalpeople);
    cout << "total fare = fare+toll , Cost Per Mile = fare / distance" << endl;
    cout << "Toll 1, 2, 3, 4 are: 4, 5, 7, 8. Fare 1, 2, 3, 4 are: 80, 15, 12, 13. " << endl;
    cout << "Mile rates are 15, 50, 40, 14, So the Cost per miles are: 5.333,.3,.3, .928 " << endl;
    
}
int totals(int totalpeople)
{
   double totalfare1[] = { 84, 15, 12, 13 };  
 
   totalpeople = 15;
   cout << totalfare1 <<"is total fares"<< endl;
   int totalpaid = 0;
   for (int i = 0; i < 4; i++) {
       totalpaid = totalpaid + totalfare1[i];
   }
   cout << totalpaid <<"is total paid"<< endl;
   float avgcostperperson;
   avgcostperperson = totalpaid / totalpeople;
   cout << avgcostperperson << "is average cost person.";
   ofstream file_("totals.txt");
   inFile.open("totals.txt");
   if (file_.is_open()) {
       file_ << totalfare1 << endl;
       file_ << totalpaid << endl;
       file_ << avgcostperperson << endl;
       file_ << totalpeople << endl;

 
   }
}