added old projects

This commit is contained in:
Austin Bennett
2026-02-03 08:18:39 -06:00
parent 43acf989bf
commit 2451448b8a
623 changed files with 28117 additions and 0 deletions
BIN
View File
Binary file not shown.
@@ -0,0 +1,284 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 55;
objects = {
/* Begin PBXBuildFile section */
D9284A732877728B00E2460C /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D9284A722877728B00E2460C /* main.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
D9284A6D2877728B00E2460C /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
D9284A6F2877728B00E2460C /* Midterm */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Midterm; sourceTree = BUILT_PRODUCTS_DIR; };
D9284A722877728B00E2460C /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
D9284A7C28777B2800E2460C /* input.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = input.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
D9284A6C2877728B00E2460C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
D9284A662877728B00E2460C = {
isa = PBXGroup;
children = (
D9284A712877728B00E2460C /* Midterm */,
D9284A702877728B00E2460C /* Products */,
);
sourceTree = "<group>";
};
D9284A702877728B00E2460C /* Products */ = {
isa = PBXGroup;
children = (
D9284A6F2877728B00E2460C /* Midterm */,
);
name = Products;
sourceTree = "<group>";
};
D9284A712877728B00E2460C /* Midterm */ = {
isa = PBXGroup;
children = (
D9284A7C28777B2800E2460C /* input.h */,
D9284A722877728B00E2460C /* main.cpp */,
);
path = Midterm;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
D9284A6E2877728B00E2460C /* Midterm */ = {
isa = PBXNativeTarget;
buildConfigurationList = D9284A762877728B00E2460C /* Build configuration list for PBXNativeTarget "Midterm" */;
buildPhases = (
D9284A6B2877728B00E2460C /* Sources */,
D9284A6C2877728B00E2460C /* Frameworks */,
D9284A6D2877728B00E2460C /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = Midterm;
productName = Midterm;
productReference = D9284A6F2877728B00E2460C /* Midterm */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
D9284A672877728B00E2460C /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1340;
TargetAttributes = {
D9284A6E2877728B00E2460C = {
CreatedOnToolsVersion = 13.4.1;
};
};
};
buildConfigurationList = D9284A6A2877728B00E2460C /* Build configuration list for PBXProject "Midterm" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = D9284A662877728B00E2460C;
productRefGroup = D9284A702877728B00E2460C /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
D9284A6E2877728B00E2460C /* Midterm */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
D9284A6B2877728B00E2460C /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D9284A732877728B00E2460C /* main.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
D9284A742877728B00E2460C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 12.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
D9284A752877728B00E2460C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 12.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
D9284A772877728B00E2460C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = N3GD25M5J3;
ENABLE_HARDENED_RUNTIME = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
D9284A782877728B00E2460C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = N3GD25M5J3;
ENABLE_HARDENED_RUNTIME = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
D9284A6A2877728B00E2460C /* Build configuration list for PBXProject "Midterm" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D9284A742877728B00E2460C /* Debug */,
D9284A752877728B00E2460C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D9284A762877728B00E2460C /* Build configuration list for PBXNativeTarget "Midterm" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D9284A772877728B00E2460C /* Debug */,
D9284A782877728B00E2460C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = D9284A672877728B00E2460C /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "1D545788-56B4-4EEB-A938-51074884970F"
type = "1"
version = "2.0">
</Bucket>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Midterm.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
+46
View File
@@ -0,0 +1,46 @@
#include <iostream>
#include <climits>
#include <string>
template <typename inputType>
inputType ReadValue(std::string prompt)
{
inputType returnValue = 0;
std::cout << prompt;
std::cin >> returnValue;
while (std::cin.fail())
{
std::cout << "Error! Cannot read input.\n";
std::cin.clear();
std::cin.ignore(INT_MAX, '\n');
std::cout << prompt;
std::cin >> returnValue;
}
return returnValue;
}
template <typename inputType>
inputType ReadValue(std::string prompt, inputType minValue)
{
inputType returnValue = 0;
returnValue = ReadValue<inputType>(prompt);
while (returnValue < minValue)
{
std::cout << "Error! Value must be >= " << minValue << std::endl;
returnValue = ReadValue<inputType>(prompt);
}
return returnValue;
}
template <typename inputType>
inputType ReadValue(std::string prompt, inputType minValue, inputType maxValue)
{
inputType returnValue = 0;
returnValue = ReadValue<inputType>(prompt, minValue);
while (returnValue > maxValue)
{
std::cout << "Error! Value must be <= " << maxValue << std::endl;
returnValue = ReadValue<inputType>(prompt, minValue);
}
return returnValue;
}
+49
View File
@@ -0,0 +1,49 @@
//
// main.cpp
// Midterm
//
// Created by Austin Bennett on 7/7/22.
//
/*
Redo question number 3 with these changes. Instead of dynamically allocating an array to store the data, your program will will an STL array. Even numbers will also be copied to an STL array. The input of the data and copying of even numbers will require the program to start at the beginning of the array and walk thorugh the values to the end. This must be done using iterators.
*/
#include <iostream>
#include <array>
#include <iterator>
#include <cmath>
#include "input.h"
using namespace std;
int main() {
array<int, 5> arr;
array<int, 5> evenArr;
array<int, 5>::iterator ptr;
array<int, 5>::iterator evenPtr = evenArr.begin();
for (ptr = arr.begin(); ptr < arr.end(); ptr++) {
*ptr = ReadValue<int>("Value: ");
}
// for (ptr = arr.begin(); ptr < arr.end(); ptr++) {
// cout << *ptr;
// }
for (ptr = arr.begin(); ptr < arr.end(); ptr++) {
if (*ptr % 2 == 0) {
*evenPtr = *ptr;
evenPtr++;
} else {
*evenPtr = NULL;
}
}
for (evenPtr = evenArr.begin(); *evenPtr != NULL; evenPtr++) {
cout << *evenPtr;
}
return 0;
}
+71
View File
@@ -0,0 +1,71 @@
### 1. When passing a C-style string as a parameter to a function - is the parameter passed by reference or default?
```
reference
```
### 2. When allocating the size of a C-style string, assume you want to store the string, "Hello, World!". What is the minimum size of the string you would need to allocate. Show how you would declare the string.
```
The minimum size would be 12 [11 for Hello World! and 1 for the null pointer]
```
```
char s[] = "Hello World!";
OR
char* s = "Hello World!";
```
# 3. TODO
# 4. TODO
### 5. What is the difference between composition and inheritence?
```
Composition is a "has-a" relationship while inheritence is a "is-a". Inheritance BASICALLY is a more strict relationship with composition allows for more flexiblity
```
### 6. What is polymorphism? Be sure to include what role virtual functions play in this and the difference between a virtual and pure virtual funciton. Be sure to include the defintion of an abstract base class.
```
Polymorphism allows the same function or object can act differently in different situations.
```
```
Virtual functions are declared by using the keyword "virtual" and return either int, float, or void. They are able to be "overwritten" to return something else.
```
```
The difference between a virtual function and a pure virtual function is that a pure virtual function is that when the function has no defintion.
```
```
An abstract base class is a class that can represent general concepts which can be used as a base for more concrete classes.
```
### 7. Assume that class B is derived publicly from class A which is abstract. The member functions that are private in class A will be private/protected/public/not directly accessible in class B.
```
not directly accesible in class B
```
### 8. Assume that you have a class that has an integer pointer as a private member. One of the member functions will dynamically allocate memory memory and assign the address to that member. Assume that an object of that class type is instantiated and the funtion called to allocate memory. When the object reaches the end of it's scope - will the memory that has been allocated be released automatically? If not, how would you create a mechanism to accomplish this. Be specific.
```
It will not. So we can use a destructor to get rid of that dynamically allocated memory
```
```
~Class() {
delete var;
}
```
### 9. What purpose does a copy constructor serve? Under what circumstances is it required?
```
a copy constructor is a function that initializes an object using another object of the same class. You what to use it when you want to duplicate an object.
```
# 10. Create a class that will store a list of names. Your class needs to include a function that will return the name that appears first aphabetically, and another function that should return the name that appears last alphabetically. You also need to include a function that will sort the list alphabetically. The class does not need to be case insensitive. The three functions should make use of the algorithms discussed in this class.