Displaying a .dat file through commandline argument

I need to create these functions for my Stations class

void update() const - accepts the number of passes sold and updates the data for each station in turn void restock() const - accepts the number of passes added and updates the data for each station in turn void report() const - reports the number of passes currently available at each station

Here is all of my code so far: http://cpp.sh/7qnpk

The expected output is:

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

 Command Line : w2 Stations.dat

 Passes Sold :
 
 Spadina
  Student Passes sold : 5
  Adult   Passes sold : 8
 Bathurst
  Student Passes sold : 34
  Adult   Passes sold : 52
 Keele
  Student Passes sold : 21
  Adult   Passes sold : 13
 Bay
  Student Passes sold : 67
  Adult   Passes sold : 65

 Passes Added :

 Spadina
  Student Passes added : 29
  Adult   Passes added : 52
 Bathurst
  Student Passes added : 113
  Adult   Passes added : 61
 Keele
  Student Passes added : 51
  Adult   Passes added : 52
 Bay
  Student Passes added : 109
  Adult   Passes added : 107

 Passes in Stock : Student Adult

 Spadina               100   200
 Bathurst              200   300
 Keele                 100   100
 Bay                   200   200


But I am not sure how to get this output.. The stations.dat file has this information:
1
2
3
4
5
4;
Spadina;76 156
Bathurst;121 291
Keele;70 61
Bay;158 158


And these functions I have to write are const, so I they cant change anything.

Just looking for some sense of direction.

I am supposed to compile this into an executable called w2 and at the command line run w2 stations.dat
Last edited on
I think posting the original question given to you would help quite a bit, because the numbers in the given file don't add up and don't help with guidance. Also... please don't name variables things like "int a" "int s" "string n" they mean nothing to people reading your code.

You have no arguments for the 3 functions you're supposed to create.
Here is the original workshop

https://scs.senecac.on.ca/~oop345/pages/workshops/w2.html

Im just not sure Im allowed to post this, but there it is.

Sorry about the confusion, thank you.

Edit: I believe those 3 functions dont need arguments, although I may be mistaken.
Last edited on
Topic archived. No new replies allowed.