You are on page 1of 2

LAB 3:

//TREXIE MAARAT ONTING PAGE 69


#include <iostream>

#include <iomanip>

#include <math.h>

#include <windows.h>

using namespace std;

int main()

int x = 0;

float seconds;

float grav = 0, distance = 0;

float meters;

cout << "\n\n\t\t\t\t Calculation for the Distance Per Second ";

cout << "\n\n\t\t\t Please input the time of fall in seconds : ";

cin >> seconds;

cout << "\n\t\t\t Please input the height of the bridge in meters : ";

cin >> meters;

cout << "\n\n\t\t\tTime Falling (seconds) \t\t\t Distance Fallen (meters)"

<< "\n\t\t\t*****************************************************************";

do {

cout<< "\n\n\t\t\t\t" << x <<"\t\t\t\t\t"<< distance;


x = x + 1;

grav = 9.8 / pow ( 1 , 2);

distance = 0.5 * grav * pow ( x , 2) ;

Sleep (500);

}while ( x <= seconds );

if (distance > meters)

cout << "\n\t\t\t --------------------------------------------------------"

<< "\n\t\t\t ..................Warning - Bad Data.................."

<< "\n\t\t\t The distance fallen exceeds the height of the bridge"

<< "\n\t\t\t --------------------------------------------------------";

cout << "\n\n\t\t\t\t\t\t Out of the Program. . . ";

cout << "\n\n\t\


t=========================================================================================="

<< "\n\t\t\tName of the programmer : TREXIE MAARAT ONTING "

<< "\n\t\t\tStudent ID number : 524552"

<< "\n\t\t\tCourse Code : EDP101 (6644) "

<< "\n\t\t\tTime : 10:00 AM - 12:00 PM"

<< "\n\t\
t==========================================================================================";

cout << endl << endl;

return 0;

You might also like