diff options
| author | Arthur Spears <[email protected]> | 2024-04-25 20:19:57 -0700 |
|---|---|---|
| committer | Arthur Spears <[email protected]> | 2024-04-25 20:19:57 -0700 |
| commit | d65138f2e040fe4193ea3fb4e2908bd0b161aadd (patch) | |
| tree | 821fc4ca98777efd74334829599ea0876fe79b08 /CST 126/Homework 1/main.cpp | |
| parent | mergine develop after PR (diff) | |
| download | homework-1-arthurtspears-Homework2.tar.xz homework-1-arthurtspears-Homework2.zip | |
Started Homework2. Stubbed out main and worker threads. Organized other source files better.Homework2
Diffstat (limited to 'CST 126/Homework 1/main.cpp')
| -rw-r--r-- | CST 126/Homework 1/main.cpp | 84 |
1 files changed, 48 insertions, 36 deletions
diff --git a/CST 126/Homework 1/main.cpp b/CST 126/Homework 1/main.cpp index e223d37..57c1541 100644 --- a/CST 126/Homework 1/main.cpp +++ b/CST 126/Homework 1/main.cpp @@ -8,56 +8,68 @@ #include "menu.hpp" #include <bitset> +#include "CST126_Structures.hpp" + using std::cout; using std::endl; -struct DailyTemperature +uLLong MAX_LENGTH = 101; + +struct Array { - int highTemp{}; - int lowTemp{}; + Array() + { + + } }; -enum DayOfTheWeek +void CharArrays() { - Sunday = 0, - Monday, - Tuesday, - Wednesday, - Thursday, - Friday, - Saturday = 6 -}; + char* inputChar = PromptInputNewCharArray("Input a string: ", MAX_LENGTH); + cout << inputChar; + delete[] inputChar; +} -enum Month +void Strings() { - January = 1, - February, - March, - April, - May, - June, - July, - August, - September, - October, - November, - December -}; + std::string myString = "Hello", mySecondString = " World"; + std::string thirdString = myString + mySecondString; + cout << thirdString; + + myString = PromptInputString("Input a new string: "); + cout << myString; +} -struct Date +void WriteToFileExample() { - Month month; - uint8_t day; - uint16_t year; -}; + char* outputToFile = PromptInputNewCharArray("Input to file:", MAX_LENGTH); -union FloatIntUnion + if (WriteToFile("new_text.txt", outputToFile)) + { + cout << "Write to file successful"; + } +} + +void ReadFromFileExample() { - float intFloat; - uint32_t uInt; -}; + if(ReadFromFileToConsole("new_text.txt")) + { + cout << "File read successfully" << endl; + } +} -int main() { +int main(int argc, char* argv[]) { + + int a = 5, b = 10; + bool condition = (a + b) < 15 && b > a; + + // Print the number of command line arguments + cout << "Number of arguments: " << argc << endl; + + // Loop through each argument + for (int i = 0; i < argc; ++i) { + cout << "Argument " << i << ": " << argv[i] << endl; + } return 0; } |