first semester files

This commit is contained in:
2024-02-22 14:31:08 -05:00
parent 0f26c9f73d
commit 2d4bbf49a4
242 changed files with 360411 additions and 0 deletions

View 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"
}
]
}

View File

@@ -0,0 +1,6 @@
{
"C_Cpp.errorSquiggles": "Enabled",
"files.associations": {
"array": "cpp"
}
}

View 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"
}

View File

@@ -0,0 +1,70 @@
/***************************************************************
* Name: Aidan Sharpe
* Course: Computer Science & Programming
* Class: CS04103 Section: 6
* Assignment Date: 11.17.2021
* File Name: Lab09-1ASharpe.cpp
*****************************************************************
* ID: Lab 9 Problem 1
* Purpose: Collect scores in a dynamically allocated array
*****************************************************************/
#include <iostream>
using namespace std;
void sort(int*, int);
int main()
{
int length, total = 0;
cout << "Please enter the number of test scores: ";
cin >> length;
int *scores = new int[length];
for(int i = 0; i < length; i++)
{
cout << "Please enter the score No. " << i << ": ";
cin >> *(scores + i);
}
sort(scores, length);
cout << "The scores in ascending order are:";
for(int i = 0; i < length; i++)
{
cout << ' ' << *(scores + i);
total += *(scores + i);
}
cout << "\nAverage score: " << total / length;
delete scores;
return 0;
}
void sort(int* ptr, int size)
{
int minIndex, minValue;
for(int start = 0; start < (size - 1); start++)
{
minIndex = start;
minValue = *(ptr + start);
for(int index = start + 1; index < size; index++)
{
if(*(ptr + index) < minValue)
{
minValue = *(ptr + index);
minIndex = index;
}
}
// swap
int temp = *(ptr + minIndex);
*(ptr + minIndex) = *(ptr + start);
*(ptr + start) = temp;
}
}