first semester files
This commit is contained in:
29
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/.vscode/launch.json
vendored
Executable file
29
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/.vscode/launch.json
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "g++.exe - Build and debug active file",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${fileDirname}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "C/C++: g++.exe build active file"
|
||||
}
|
||||
]
|
||||
}
|
||||
28
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/.vscode/tasks.json
vendored
Executable file
28
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/.vscode/tasks.json
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: g++.exe build active file",
|
||||
"command": "C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\g++.exe",
|
||||
"args": [
|
||||
"-fdiagnostics-color=always",
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}\\${fileBasenameNoExtension}.exe"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${fileDirname}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "Task generated by Debugger."
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
||||
14
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/GradeMenu.cpp
Executable file
14
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/GradeMenu.cpp
Executable file
@@ -0,0 +1,14 @@
|
||||
#include <iostream>
|
||||
#include "GradeMenu.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// display the selection menu and prompt the user
|
||||
void GradeMenu::displayMenu()
|
||||
{
|
||||
cout << "1. Enter student and grade information" << endl
|
||||
<< "2. Adjust student grade information" << endl
|
||||
<< "3. Display sudent grades" << endl
|
||||
<< "4. Exit" << endl << endl
|
||||
<< ">>> ";
|
||||
}
|
||||
11
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/GradeMenu.h
Executable file
11
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/GradeMenu.h
Executable file
@@ -0,0 +1,11 @@
|
||||
#ifndef GRADEMENU_H
|
||||
#define GRADEMENU_H
|
||||
|
||||
class GradeMenu
|
||||
{
|
||||
public:
|
||||
void displayMenu();
|
||||
Counter();
|
||||
};
|
||||
|
||||
#endif
|
||||
BIN
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/a.exe
Executable file
BIN
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/a.exe
Executable file
Binary file not shown.
105
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/main.cpp
Executable file
105
1st-Semester-Fall-2021/CSNP/CSNP-04103-Lab-#6/main.cpp
Executable file
@@ -0,0 +1,105 @@
|
||||
/***************************************************************
|
||||
* Name: Aidan Sharpe
|
||||
* Course: Computer Science & Programming
|
||||
* Class: CS04103 Section: 6
|
||||
* Assignment Date: 10.27.2021
|
||||
* File Name: main.cpp
|
||||
*****************************************************************
|
||||
* ID: Lab 6 Problem 1
|
||||
* Purpose: Manage the grades of 3 students
|
||||
*****************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "GradeMenu.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void enterGrades(struct Student[]);
|
||||
void adjustGrades(struct Student[]);
|
||||
void displayGrades(struct Student[]);
|
||||
|
||||
struct Student
|
||||
{
|
||||
string name;
|
||||
int classId;
|
||||
float grade;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
int selection = 1;
|
||||
char tryAgain;
|
||||
Student students[3];
|
||||
GradeMenu gm = GradeMenu();
|
||||
|
||||
do
|
||||
{
|
||||
// display the selection menu
|
||||
gm.displayMenu();
|
||||
cin >> selection;
|
||||
|
||||
// clear the screen and continue
|
||||
system("clear");
|
||||
switch (selection)
|
||||
{
|
||||
case 1:
|
||||
enterGrades(students);
|
||||
break;
|
||||
case 2:
|
||||
adjustGrades(students);
|
||||
break;
|
||||
case 3:
|
||||
displayGrades(students);
|
||||
break;
|
||||
case 4:
|
||||
return 0;
|
||||
|
||||
// if the entry is invalid, the default case will execute
|
||||
default:
|
||||
cout << "INVALID INPUT: please enter a value between 1 and 4. Input c to try again." << endl;
|
||||
cin >> tryAgain;
|
||||
if (tryAgain != 'c')
|
||||
return 0;
|
||||
}
|
||||
} while (true); // run until the user exits the program or does not try again after invalid input
|
||||
|
||||
}
|
||||
|
||||
// edit all properties of each student
|
||||
void enterGrades(Student students[])
|
||||
{
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
cout << endl << "Full Name: ";
|
||||
cin.ignore();
|
||||
getline(cin, students[i].name);
|
||||
cout << "Class ID: ";
|
||||
cin >> students[i].classId;
|
||||
cout << "Grade: ";
|
||||
cin >> students[i].grade;
|
||||
}
|
||||
}
|
||||
|
||||
// loop through each student in the list and update his grade
|
||||
void adjustGrades(Student students[])
|
||||
{
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
cout << "New Grade for " << students[i].name << ": ";
|
||||
cin >> students[i].grade;
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// display the grade of each student
|
||||
void displayGrades(Student students[])
|
||||
{
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
cout << "Student ID: " << i + 1 << endl
|
||||
<< "Full Name: " << students[i].name << endl
|
||||
<< "Grade: " << students[i].grade << endl
|
||||
<< "Class ID: " << students[i].classId << endl << endl;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user