diff options
| author | Connor McDowell <[email protected]> | 2024-02-10 12:37:31 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-02-10 12:37:31 -0800 |
| commit | 3dbbabdb1d5d990ac2c5bd03a0437d8395b31a4a (patch) | |
| tree | 92484758f5155380aff16b01bb0370332715f0f1 /Project1 | |
| parent | built c array and standard array (diff) | |
| download | lab-01-connormcdowell275-3dbbabdb1d5d990ac2c5bd03a0437d8395b31a4a.tar.xz lab-01-connormcdowell275-3dbbabdb1d5d990ac2c5bd03a0437d8395b31a4a.zip | |
i dunno whats wrong its saying there should be a ; where there shouldnt and erroring
Diffstat (limited to 'Project1')
| -rw-r--r-- | Project1/helper.cpp | 9 | ||||
| -rw-r--r-- | Project1/helper.h | 7 | ||||
| -rw-r--r-- | Project1/program.cpp | 15 |
3 files changed, 13 insertions, 18 deletions
diff --git a/Project1/helper.cpp b/Project1/helper.cpp index 0e90444..85b6ac4 100644 --- a/Project1/helper.cpp +++ b/Project1/helper.cpp @@ -1,18 +1,15 @@ #include <iostream> #include <array> +#include <vector> #include "helper.h" -using std::cout; -using std::cin; -using std::endl; - void Print(int(&cArray)[SIZE]) { for(auto element: cArray) { - cout << element << endl; + std::cout << element << std::endl; } } @@ -20,6 +17,6 @@ void Print_std(std::array<int, SIZE> stdArray[]) { for (auto i = 0u; i < stdArray->size(); i++) { - cout << stdArray[i] << endl; + std::cout << i << std::endl; } } diff --git a/Project1/helper.h b/Project1/helper.h index 0133560..0d2f876 100644 --- a/Project1/helper.h +++ b/Project1/helper.h @@ -1,10 +1,13 @@ #ifndef HELPER #define HELPER +#include <array> +#include <vector> + constexpr int SIZE = 12000; -void Print(int(&cArray)[SIZE]); +void Print(const int(&cArray)[SIZE]); -void Print_std(int stdArray[]); +void Print_std(std::array<int, SIZE> stdArray[]) #endif HELPER diff --git a/Project1/program.cpp b/Project1/program.cpp index c21c58a..ddd5d58 100644 --- a/Project1/program.cpp +++ b/Project1/program.cpp @@ -5,26 +5,23 @@ #include <iostream> #include <array> +#include <vector> #include "helper.h" -using std::cout; -using std::cin; -using std::endl; - int main() { - /*int cArray[SIZE]; + int cArray[SIZE]; for(int i = 0; i < SIZE; i++) { cArray[i] = i; } - int t;*/ + int t; - //std::array<size_t, SIZE> a = { t }; + std::array<int, SIZE> stdArray = { }; for(int t = 0; t < SIZE; t++) @@ -32,9 +29,7 @@ int main() stdArray[t] = t; } - //Print(&stdArray); - - void Print_std(std::array<int, SIZE> stdArray[]); + Print_std(&stdArray); /*Print(cArray);*/ |