aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk6
diff options
context:
space:
mode:
Diffstat (limited to 'ee1301/wk6')
-rw-r--r--ee1301/wk6/lab5/vectorArray.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/ee1301/wk6/lab5/vectorArray.cpp b/ee1301/wk6/lab5/vectorArray.cpp
index 8d2ad38..6e2d548 100644
--- a/ee1301/wk6/lab5/vectorArray.cpp
+++ b/ee1301/wk6/lab5/vectorArray.cpp
@@ -35,9 +35,9 @@ double randVec() {
double momentum(double velocity) {
double mass;
if (rand()%2+1==0) {
- mass=rand()%10+1;
+ mass=rand()%10+1.0;
} else {
- mass=rand()%10*-1+1;
+ mass=rand()%10*-1.0+1.0;
}
- return velocity*mass;
+ return mass*velocity;
} \ No newline at end of file