aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab5/CST116F2021-Lab5.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116F2021-Lab5/CST116F2021-Lab5.cpp')
-rw-r--r--CST116F2021-Lab5/CST116F2021-Lab5.cpp164
1 files changed, 150 insertions, 14 deletions
diff --git a/CST116F2021-Lab5/CST116F2021-Lab5.cpp b/CST116F2021-Lab5/CST116F2021-Lab5.cpp
index e7591f7..53991b1 100644
--- a/CST116F2021-Lab5/CST116F2021-Lab5.cpp
+++ b/CST116F2021-Lab5/CST116F2021-Lab5.cpp
@@ -1,20 +1,156 @@
-// CST116F2021-Lab5.cpp : This file contains the 'main' function. Program execution begins and ends there.
-//
+//Code by Jordan Harris-Toovy for OIT's CST116 Lab 5, November 2021
-#include <iostream>
+//NOTE: When evaluating code, please keep in mind that global vars have been moved the header file.
-int main()
+#include "Main_header.h"
+
+//10.5 LBD-Ex #1
+
+/*
+int main(void)
{
- std::cout << "Hello World!\n";
+ float student_score[NUM_SCORES] = {0.0F}, class_avarage = 0.0F;
+ char student_grade[NUM_SCORES] = {'X'};
+ int total_scores[NUM_GRADES] = { 0 };
+
+ for (int idx = 0; idx < NUM_SCORES; idx++)
+ {
+ cout << "Enter score #" << idx + 1 << " of " << NUM_SCORES << ": ";
+ cin >> student_score[idx];
+
+ if (student_score[idx] >= 92.0F)
+ {
+ student_grade[idx] = 'A';
+ total_scores[0]++;
+ }
+ else if (student_score[idx] >= 84.0F)
+ {
+ student_grade[idx] = 'B';
+ total_scores[1]++;
+ }
+ else if (student_score[idx] >= 75.0F)
+ {
+ student_grade[idx] = 'C';
+ total_scores[2]++;
+ }
+ else if (student_score[idx] >= 65.0F)
+ {
+ student_grade[idx] = 'D';
+ total_scores[3]++;
+ }
+ else if (student_score[idx] >= 0.0F)
+ {
+ student_grade[idx] = 'F';
+ total_scores[4]++;
+ }
+ else
+ {
+ cout << endl << "Score error" << endl;
+ return -1;
+ }
+
+ cout << "Score: " << student_score[idx] << " Grade: " << student_grade[idx] << endl;
+
+ class_avarage += student_score[idx];
+
+ }
+
+ class_avarage /= NUM_SCORES;
+
+ cout << endl << "The average score is: " << class_avarage << "%" << endl;
+ cout << "Distribution of achieved grades:" << endl << "A: " << total_scores[0] << endl << "B: " << total_scores[1]
+ << endl << "C: " << total_scores[2] << endl << "D: " << total_scores[3] << endl << "F: " << total_scores[4] << endl;
+
+ return 0;
+}
+*/
+
+
+//10.6 LBD-Ex #1 INCOMPLETE
+
+/*
+int main(void)
+{
+ float student_score[NUM_SCORES] = { 0.0F }, class_avarage = 0.0F;
+ char student_grade[NUM_SCORES] = { 'X' };
+ int total_scores[NUM_GRADES] = { 0 };
+
+ get_scores(student_score);
+
+ grade_scores(student_score, student_grade);
+
+ total_grades(student_grade, total_scores);
+
+ class_avarage = average_scores(student_score);
+
+ display_info(class_avarage, total_scores, student_grade, student_score);
+
+ return 0;
}
+*/
-// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
-// Debug program: F5 or Debug > Start Debugging menu
-// Tips for Getting Started:
-// 1. Use the Solution Explorer window to add/manage files
-// 2. Use the Team Explorer window to connect to source control
-// 3. Use the Output window to see build output and other messages
-// 4. Use the Error List window to view errors
-// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
-// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
+//10.7 LBD-Ex #2 (Mislabeled as "9.5 LBD-Ex #2")
+
+/*
+int main(void)
+{
+ char firstName[NAMELENGTHMAX]{}, lastName[NAMELENGTHMAX]{}, totalName[NAMELENGTHMAX * 2]{};
+ int firstSize = 0, lastSize = 0;
+
+ getName(firstName, 0);
+ getName(lastName, 1);
+
+ firstSize = getStringSize(firstName);
+ lastSize = getStringSize(lastName);
+
+ for (int idx = 0; idx < firstSize; idx++)
+ {
+ totalName[idx] = firstName[idx];
+ }
+
+ totalName[firstSize] = ',';
+ totalName[firstSize + 1] = ' ';
+
+ for (int idx = 0; idx < lastSize; idx++)
+ {
+ totalName[firstSize + 2 + idx] = lastName[idx];
+ }
+
+ totalName[firstSize + 3 + lastSize] = '\0';
+
+ cout << "\nYour full name is: " << totalName <<endl;
+
+ return 0;
+}
+*/
+
+
+//10.8 Ex #7 (Mislabeled as "9.6 LBD-Ex #7")
+
+/*
+int main(void)
+{
+ char string_1[25] = "X", string_2[25] = "X";
+ bool compair = true;
+ int num_compair = 1;
+
+ get_string(string_1, 0);
+ get_string(string_2, 1);
+
+ cout << "\nEnter the number of characters to compair (left to right): ";
+ cin >> num_compair;
+
+ compair = string_compair_N(string_1, string_2, num_compair);
+
+ if (compair)
+ {
+ cout << "\nThe first " << num_compair << " characters match." << endl;
+ }
+ else
+ {
+ cout << "\nThere is a mismatch within the fisrt " << num_compair << " characters." << endl;
+ }
+ return (0);
+}
+*/ \ No newline at end of file