aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWiserJ <[email protected]>2021-11-02 15:07:38 -0700
committerWiserJ <[email protected]>2021-11-02 15:07:38 -0700
commit9d0b656974bc16dbedcffb09c2d447fa0a2cd457 (patch)
treef1702d479820f25787b69d07625cbd9079fec0db
parent3 file solution (diff)
downloadcst116-lab5-jeffwoit-9d0b656974bc16dbedcffb09c2d447fa0a2cd457.tar.xz
cst116-lab5-jeffwoit-9d0b656974bc16dbedcffb09c2d447fa0a2cd457.zip
260
-rw-r--r--CST116F2021-Lab5/CST116F2021-Lab5.cpp48
-rw-r--r--CST116F2021-Lab5/CST116F2021-Lab5.vcxproj1
-rw-r--r--CST116F2021-Lab5/CST116F2021-Lab5.vcxproj.filters3
-rw-r--r--CST116F2021-Lab5/Header1.h26
-rw-r--r--CST116F2021-Lab5/Source1.cpp140
-rw-r--r--CST116F2021-Lab5/p260.cpp18
-rw-r--r--Source2.cpp0
7 files changed, 143 insertions, 93 deletions
diff --git a/CST116F2021-Lab5/CST116F2021-Lab5.cpp b/CST116F2021-Lab5/CST116F2021-Lab5.cpp
index d305c1e..7446117 100644
--- a/CST116F2021-Lab5/CST116F2021-Lab5.cpp
+++ b/CST116F2021-Lab5/CST116F2021-Lab5.cpp
@@ -3,6 +3,23 @@
#include "Header1.h"
+
+int main()
+{
+ char firstName[FIRST_NAME]{};
+ char lastName[LAST_NAME]{};
+ char fullName[FULL_NAME]{};
+
+ GetFirst(firstName);
+ GetLast(lastName);
+ DispName(firstName, lastName, fullName)
+}
+
+
+
+
+
+
//#include <iostream>
//
//using namespace std;
@@ -16,21 +33,22 @@
//const int NUM_STUD = 5;
//const int NUM_GRADE = 5;
-int main()
-{
- float currStudent[NUM_SCORES]{ 0.0 };
- char Grade[NUM_SCORES];
- int numGrade[NUM_GRADE]{ 0 };
- float avg = 0.0;
-
- GetScores(currStudent);
- CheckGrade(currStudent, Grade);
- calcAvg(currStudent, avg);
- CountScores(Grade, numGrade);
-
-
- return 0;
-}
+//p.253
+//int main()
+//{
+// float currStudent[NUM_SCORES]{ 0.0 };
+// char Grade[NUM_SCORES];
+// int numGrade[NUM_GRADE]{ 0 };
+// float avg = 0.0;
+//
+// GetScores(currStudent);
+// CheckGrade(currStudent, Grade);
+// calcAvg(currStudent, avg);
+// CountScores(Grade, numGrade);
+//
+//
+// return 0;
+//}
//void GetScores(float score_input[])
//{
diff --git a/CST116F2021-Lab5/CST116F2021-Lab5.vcxproj b/CST116F2021-Lab5/CST116F2021-Lab5.vcxproj
index 2bceceb..072f09b 100644
--- a/CST116F2021-Lab5/CST116F2021-Lab5.vcxproj
+++ b/CST116F2021-Lab5/CST116F2021-Lab5.vcxproj
@@ -140,6 +140,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="CST116F2021-Lab5.cpp" />
+ <ClCompile Include="p260.cpp" />
<ClCompile Include="Source1.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/CST116F2021-Lab5/CST116F2021-Lab5.vcxproj.filters b/CST116F2021-Lab5/CST116F2021-Lab5.vcxproj.filters
index f7a8d4b..a3a1128 100644
--- a/CST116F2021-Lab5/CST116F2021-Lab5.vcxproj.filters
+++ b/CST116F2021-Lab5/CST116F2021-Lab5.vcxproj.filters
@@ -21,6 +21,9 @@
<ClCompile Include="Source1.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="p260.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Header1.h">
diff --git a/CST116F2021-Lab5/Header1.h b/CST116F2021-Lab5/Header1.h
index 693d4af..403d914 100644
--- a/CST116F2021-Lab5/Header1.h
+++ b/CST116F2021-Lab5/Header1.h
@@ -2,12 +2,22 @@
using namespace std;
-void GetScores(float[]);
-void CheckGrade(float[], char[]);
-float calcAvg(float[], float avg);
-void CountScores(char[], int[]);
-
-const int NUM_SCORES = 10;
-const int NUM_STUD = 5;
-const int NUM_GRADE = 5;
+void GetFirst(char[]);
+void GetLast(char[]);
+void DispName(char[], char[], char[]);
+
+const int FIRST_NAME = 15;
+const int LAST_NAME = 15;
+const int FULL_NAME = 2+FIRST_NAME + LAST_NAME;
+
+
+//p.253
+//void GetScores(float[]);
+//void CheckGrade(float[], char[]);
+//float calcAvg(float[], float avg);
+//void CountScores(char[], int[]);
+//
+//const int NUM_SCORES = 10;
+//const int NUM_STUD = 5;
+//const int NUM_GRADE = 5;
#pragma once
diff --git a/CST116F2021-Lab5/Source1.cpp b/CST116F2021-Lab5/Source1.cpp
index 9e7b450..55c2782 100644
--- a/CST116F2021-Lab5/Source1.cpp
+++ b/CST116F2021-Lab5/Source1.cpp
@@ -1,70 +1,70 @@
-#include "Header1.h"
-
-void GetScores(float score_input[])
-{
- //Loop for storing scores to array
- for (int i = 0; i < NUM_SCORES; i++)
- {
- cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": ";
- cin >> score_input[i];
- }
-}
-
-void CheckGrade(float score_input[], char grade_output[])
-{
- //Loop for comparing scores to letter grade then storing to another array
- for (int i = 0; i < NUM_SCORES; i++)
- {
- if (score_input[i] >= 92.0)
- grade_output[i] = 'A';
- else if (score_input[i] >= 84.0)
- grade_output[i] = 'B';
- else if (score_input[i] >= 75.0)
- grade_output[i] = 'C';
- else if (score_input[i] >= 65.0)
- grade_output[i] = 'D';
- else
- grade_output[i] = 'F';
-
- cout << "\nTest #" << i + 1 << " scored " << score_input[i] << " and received grade " << grade_output[i];
- }
-}
-
-float calcAvg(float score_input[], float avg)
-{
- //Calc class average
- for (int i = 0; i < NUM_SCORES; i++)
- {
- avg += score_input[i];
- }
-
- avg /= NUM_SCORES;
-
- cout << "\n\nThe class average for " << NUM_SCORES << " scores is " << avg << endl;
-
- return avg;
-}
-
-void CountScores(char grade_output[], int nGrade[])
-{
- //Loop for counting number of each letter grade
- for (int i = 0; i < NUM_SCORES; i++)
- {
- if (grade_output[i] == 'A')
- nGrade[0] += 1;
- else if (grade_output[i] == 'B')
- nGrade[1] += 1;
- else if (grade_output[i] == 'C')
- nGrade[2] += 1;
- else if (grade_output[i] == 'D')
- nGrade[3] += 1;
- else
- nGrade[4] += 1;
- }
-
- cout << "\nThe number of Grade A tests is: " << nGrade[0];
- cout << "\nThe number of Grade B tests is: " << nGrade[1];
- cout << "\nThe number of Grade C tests is: " << nGrade[2];
- cout << "\nThe number of Grade D tests is: " << nGrade[3];
- cout << "\nThe number of Grade F tests is: " << nGrade[4];
-} \ No newline at end of file
+//#include "Header1.h"
+//
+//void GetScores(float score_input[])
+//{
+// //Loop for storing scores to array
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": ";
+// cin >> score_input[i];
+// }
+//}
+//
+//void CheckGrade(float score_input[], char grade_output[])
+//{
+// //Loop for comparing scores to letter grade then storing to another array
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// if (score_input[i] >= 92.0)
+// grade_output[i] = 'A';
+// else if (score_input[i] >= 84.0)
+// grade_output[i] = 'B';
+// else if (score_input[i] >= 75.0)
+// grade_output[i] = 'C';
+// else if (score_input[i] >= 65.0)
+// grade_output[i] = 'D';
+// else
+// grade_output[i] = 'F';
+//
+// cout << "\nTest #" << i + 1 << " scored " << score_input[i] << " and received grade " << grade_output[i];
+// }
+//}
+//
+//float calcAvg(float score_input[], float avg)
+//{
+// //Calc class average
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// avg += score_input[i];
+// }
+//
+// avg /= NUM_SCORES;
+//
+// cout << "\n\nThe class average for " << NUM_SCORES << " scores is " << avg << endl;
+//
+// return avg;
+//}
+//
+//void CountScores(char grade_output[], int nGrade[])
+//{
+// //Loop for counting number of each letter grade
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// if (grade_output[i] == 'A')
+// nGrade[0] += 1;
+// else if (grade_output[i] == 'B')
+// nGrade[1] += 1;
+// else if (grade_output[i] == 'C')
+// nGrade[2] += 1;
+// else if (grade_output[i] == 'D')
+// nGrade[3] += 1;
+// else
+// nGrade[4] += 1;
+// }
+//
+// cout << "\nThe number of Grade A tests is: " << nGrade[0];
+// cout << "\nThe number of Grade B tests is: " << nGrade[1];
+// cout << "\nThe number of Grade C tests is: " << nGrade[2];
+// cout << "\nThe number of Grade D tests is: " << nGrade[3];
+// cout << "\nThe number of Grade F tests is: " << nGrade[4];
+//} \ No newline at end of file
diff --git a/CST116F2021-Lab5/p260.cpp b/CST116F2021-Lab5/p260.cpp
new file mode 100644
index 0000000..d36cb5d
--- /dev/null
+++ b/CST116F2021-Lab5/p260.cpp
@@ -0,0 +1,18 @@
+#include "Header1.h"
+
+void GetFirst(char inputFirst[])
+{
+ cout << "Please enter your first name: ";
+ cin >> inputFirst;
+}
+
+void GetLast(char inputLast[])
+{
+ cout << "Please enter your last name: ";
+ cin >> inputLast;
+}
+
+void DispName(char outputFirst[], char outputLast[], char outputFull[])
+{
+
+} \ No newline at end of file
diff --git a/Source2.cpp b/Source2.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source2.cpp