How does everything look?

This is one of the programs I did recently.

I feel like I did a good job with this one, but I'm no expert, and I make silly mistakes.

Anything I should change or is it all good?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//Ashton Dreiling
//Falling distance exercise
#include <iostream>
#include <stdlib.h>

//global constants
const int MAX_VALUE=10;
const double HALF=1.0/2;
const double NUM_FOR_CAL_IN_DISTANCE_FORMULA=9.8;
const int ZERO_FOR_CAL=1;

//module prototype
double fallingDistance(int);


using namespace std;

int main()
{
    //some variables
    double distance;
    int seconds=0;

    cout << "Hello, we are going to be displaying the falling distance that corresponds to the values 1-10 which are seconds!" << endl;
    //setting up table
    cout << "Seconds\t\t\tDistance" << endl;
    cout << "---------------------------------" << endl;

    //counting-loop function
    for (seconds = ZERO_FOR_CAL; seconds<=MAX_VALUE; ++seconds)
    {
        distance=fallingDistance(seconds);
        cout << seconds << "\t\t\t" << distance << endl;
    }//end of for function

    system("Pause");

    return 0;
}//end main

//return function
double fallingDistance(int seconds)
{
    double D;
    D=(HALF*NUM_FOR_CAL_IN_DISTANCE_FORMULA * seconds*seconds);
    return D;
}//end of fallingDistance function 
Last edited on
It's ok :)
Really? Haha, wow. Cool!
const int ZERO_FOR_CAL=1;

o_O zero for cal is 1???

anyways like the closed account said, its nice...
Got to fix that. Thanks!
welcome :)
Good comments, nice use of global variables, nice organized output of data..
Looks good to me :D
well done!
good job! :)
Nice
Topic archived. No new replies allowed.