summaryrefslogtreecommitdiff
path: root/CST116-Lab3-Smith-Pseudo-Code.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CST116-Lab3-Smith-Pseudo-Code.txt')
-rw-r--r--CST116-Lab3-Smith-Pseudo-Code.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/CST116-Lab3-Smith-Pseudo-Code.txt b/CST116-Lab3-Smith-Pseudo-Code.txt
new file mode 100644
index 0000000..8a3843e
--- /dev/null
+++ b/CST116-Lab3-Smith-Pseudo-Code.txt
@@ -0,0 +1,27 @@
+main():
+1) Setup stream to the already existing file with the data
+2) If the file opened correctly, start a while loop until the end of the file is reached, counting how many times it loops
+ 2.1) Read all its data to the already initialized arrays for each type of value storage
+ 2.2) Close the file
+3) If the file didn't open correctly, give an error and end the program
+4) Collect the user's input for the name of the output file
+5) Setup stream to create or overwrite a file for data to be transferred to using the user's previously input name
+6) If the file opened correctly, start a for loop for as many times the counting variable didn't see the end of the in file
+ 6.1) Do the math to output the correct fare and cost-per-mile values to the file
+ 6.2) Close the file
+7) If the file didn't open correctly, give an error and end the program
+8) Call the Other_Calculations function using the array 'total_fare' and the counting variable from earlier
+9) return 0;
+
+
+Other_Calculations:
+1) cout << endl a few times to create a visually pleasing spacing
+2) Output the total number of travellers (the counting variable form earlier's value)
+3) Output the total amount of the fares combined, calling the Fare_Calc function using the 'total_fare' array and the counting variable from earlier
+4) Output the average cost per person (Far_Calc / counting variable from earlier)
+
+
+Fare_Cals:
+1) Initialize the 'sum' variable to 0
+2) Add the totals of all the fares in the 'total_fare' to the 'sum' variable
+3) return sum; \ No newline at end of file