aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab5/CST116F2021-Lab5.cpp
blob: 53991b13dee2a18132a473077154006925c7cf8d (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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//Code by Jordan Harris-Toovy for OIT's CST116 Lab 5, November 2021

//NOTE: When evaluating code, please keep in mind that global vars have been moved the header file.

#include "Main_header.h"

//10.5 LBD-Ex #1

/*
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 };

	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;
}
*/


//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);
}
*/