diff options
| author | Connor McDowell <[email protected]> | 2024-02-10 13:37:34 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-10 13:37:34 -0800 |
| commit | a6cbf2ae0d6d953a2e9da7f069c184853fca3cc3 (patch) | |
| tree | 7920404119bc2c64a0699afcc23fa5a5f3b71651 /Project1/program.cpp | |
| parent | i dunno whats wrong its saying there should be a ; where there shouldnt and e... (diff) | |
| download | lab-01-connormcdowell275-a6cbf2ae0d6d953a2e9da7f069c184853fca3cc3.tar.xz lab-01-connormcdowell275-a6cbf2ae0d6d953a2e9da7f069c184853fca3cc3.zip | |
errors fixed, vectors and lists made, still working on lists
Diffstat (limited to 'Project1/program.cpp')
| -rw-r--r-- | Project1/program.cpp | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/Project1/program.cpp b/Project1/program.cpp index ddd5d58..29033dc 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -3,36 +3,73 @@ // class: CST116 // Reason: lab #1 +#include "helper.h" #include <iostream> #include <array> #include <vector> -#include "helper.h" +#include <list> +using std::cin; +using std::cout; +using std::endl; +using std::array; +using std::vector; +using std::list; -int main() +void createArray() { int cArray[SIZE]; - for(int i = 0; i < SIZE; i++) + for (int i = 0; i < SIZE; i++) { cArray[i] = i; } + Print(cArray); +} - int t; - - +void createstdArray() +{ std::array<int, SIZE> stdArray = { }; - for(int t = 0; t < SIZE; t++) + for (int i = 0; i < SIZE; i++) { - stdArray[t] = t; + stdArray[i] = i; } - Print_std(&stdArray); + Print(stdArray); +} - /*Print(cArray);*/ +void createVector() +{ + std::vector<int> myVector; + myVector.reserve(SIZE); + for (auto i = 0; i < SIZE; i++) + { + myVector.push_back(i); + } + Print(myVector); +} + +void Create_list() +{ + int i, t; + std::list<int> myList (SIZE, i); + for (auto i = 0; i < SIZE; i++) + { + myList.push_back(i); + } + Print(myList); +} + +int main() +{ + //createArray(); + //createstdArray(); + //createVector(); + Create_list(); + return 0; |