diff options
author | RossTheRoss <msattr@gmail.com> | 2019-04-02 21:43:08 -0500 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-04-02 21:43:08 -0500 |
commit | dd41a64838e2b8d8cecef9d8a278e1ce58f274ee (patch) | |
tree | 9e83650cb8563f00b0c2c6dea21598901a783e9a /ee1301/wk5/hw5_directory/strap012_HW5B.cpp | |
parent | Update strap012_HW5C.cpp (diff) | |
download | homework-dd41a64838e2b8d8cecef9d8a278e1ce58f274ee.tar homework-dd41a64838e2b8d8cecef9d8a278e1ce58f274ee.tar.gz homework-dd41a64838e2b8d8cecef9d8a278e1ce58f274ee.tar.bz2 homework-dd41a64838e2b8d8cecef9d8a278e1ce58f274ee.tar.lz homework-dd41a64838e2b8d8cecef9d8a278e1ce58f274ee.tar.xz homework-dd41a64838e2b8d8cecef9d8a278e1ce58f274ee.tar.zst homework-dd41a64838e2b8d8cecef9d8a278e1ce58f274ee.zip |
Do more work
Diffstat (limited to 'ee1301/wk5/hw5_directory/strap012_HW5B.cpp')
-rw-r--r-- | ee1301/wk5/hw5_directory/strap012_HW5B.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ee1301/wk5/hw5_directory/strap012_HW5B.cpp b/ee1301/wk5/hw5_directory/strap012_HW5B.cpp index ca6d150..8508283 100644 --- a/ee1301/wk5/hw5_directory/strap012_HW5B.cpp +++ b/ee1301/wk5/hw5_directory/strap012_HW5B.cpp @@ -1,4 +1,5 @@ #include <iostream> +#include <time.h> #include <cstdlib> using namespace std; @@ -22,9 +23,9 @@ int main(int argc, char *argv[]) for (int curCol = 0; curCol < n; curCol++) { if (rand() % 2 + 1 == 2) { //Decide the sign of the number - randArray[curRow][curCol] = -1 * (rand() % (max+1)); + randArray[curCol][curRow] = -1 * (rand() % (max+1)); } else { - randArray[curRow][curCol] = (rand() % (max+1)); + randArray[curCol][curRow] = (rand() % (max+1)); } } } @@ -34,7 +35,7 @@ int main(int argc, char *argv[]) { for (int curCol = 0; curCol < n; curCol++) { - cout << randArray[curRow][curCol] << " "; + cout << randArray[curCol][curRow] << " "; } cout << endl; } |