Write a program that computes how many meters an object falls in 1 second, 2 seconds,
etc., up to 10 seconds.
First create a Raptor flowchart. For this assignment you will need to switch to
intermediate mode.
Your Raptor program should:
1. Have a procedure called FallingDistance which has one input parameter, seconds,
and one output parameter, distance.
2. Compute the distance an object falls usingthis formula:
d = 0.5 * 9.8 * t^2 (t being seconds)
3. The main program should call FallingDistance within a loop which passes the
values 1 through 10 as arguments.
4. Print a table with seconds and falling distance in meters.
Once your Raptor flowchart executes correctly, upload your .rap file. Make sure your
name is on the flowchart in a comment.
Sample Output (This program has no input)
Seconds Distance
==============
1 4.9
2 19.6
3 44.1
4 78.4
5 122.5
6 176.4
7 240.1
8 313.6
9 396.9
10 490
I have created the flowchart and now I need to write it in C++ using visual basic. This is what I have so far. (Yes I know its wrong.. probably by alot.. I have tried as you can see)
3. The main program should call FallingDistance within a loop which passes the
values 1 through 10 as arguments.
Your function is passing seconds and distance. It doesn't need to. It just needs to pass the time, as everything else in the calculation is a constant. Just pass in the time as a parameter and return the equation given in point two of your specification above. You've got yourself a quick, one-line function there.
Then you'd just call it in a loop, passing in the new time at each iteration.
See you are not calling function correctly, it should be a syntax error.
on line 22 it should be like this.
FallingDistance( Seconds);
the reason for only one argument is that you have used this in main and there is no other thing in the main to be sent to the function. Further you will also need to change this in the definition and prototype.
3rd thing which you are doing wrong is you are not storing the result of the return by the function in anything and you need to store it in some variable and then print that variable.
4th thing there is no need for second to be double.
see this program if have completed this.
#include <iostream>
#include <iomanip>
using namespace std;