From 5734d553ca690ee3ab4da6094c398671cced8b76 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Mon, 22 Apr 2019 12:30:35 -0500 Subject: Finish Lab late --- ee1301/wk6/lab5/momentum.cpp | 22 ++++++++++++++++++++++ ee1301/wk6/lab5/strap012_lab5_w_1.cpp | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 ee1301/wk6/lab5/momentum.cpp (limited to 'ee1301/wk6') diff --git a/ee1301/wk6/lab5/momentum.cpp b/ee1301/wk6/lab5/momentum.cpp new file mode 100644 index 0000000..ef7a7e7 --- /dev/null +++ b/ee1301/wk6/lab5/momentum.cpp @@ -0,0 +1,22 @@ +#include + +double* momentum (double velocity[3], double mass); + +int main() { + double velocity[3]; + double mass; + std::cout << "Please enter velocity (x y z) [m/s]: "; + std::cin >> velocity[0] >> velocity[1] >> velocity [2]; + std::cout << "Please enter mass [kg]: "; + std::cin >> mass; + momentum(&velocity[3], mass); +} + +double* momentum(double velocity[3], double mass) { + double* vector; + vector = new double[3]; + for (int i=0; i<2; i++) { + vector[i]=velocity[i]*mass; + } + return vector; +} \ No newline at end of file diff --git a/ee1301/wk6/lab5/strap012_lab5_w_1.cpp b/ee1301/wk6/lab5/strap012_lab5_w_1.cpp index f503fc9..d42cd95 100644 --- a/ee1301/wk6/lab5/strap012_lab5_w_1.cpp +++ b/ee1301/wk6/lab5/strap012_lab5_w_1.cpp @@ -1,5 +1,5 @@ #include -//#include //Needed if using MinGW +//#include //Needed if using MinGW class DeckOfCards { private: -- cgit v1.2.3