blob: 3b768acda13bab0387e6d6530882bf72bc1fc12c (
plain) (
blame)
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
48
49
|
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
/*
Thomas Trinh
CST116
Lab 1 Kite Dimensions
*/
#include <iostream>
using namespace std;
float width = 0;
float length = 0;
float area = 0;
float ratio = 0;
float mass = 0;
float gravitational_pull = 0;
int main()
{
while (width > 400 || 1 > width)
{
cout << "Enter width in cm: ";
cin >> width;
if (width > 400 || 1 > width)
cout << "Number cannot be greater than 400 or less than 1" << endl;
};
while (length > 400 || 1 > length)
{
cout << "Enter length in cm: ";
cin >> length;
if (length > 400 || 1 > length)
cout << "Number cannot be greater than 400 or less than 1" << endl;
};
area = ((length * width)/2.0)/10000.0;
cout << "Area in square meters: " << area << endl;
ratio = width / length;
cout << "Ratio: " << ratio << endl;
if (ratio >= 1)
cout << "Warning: use a lower ratio for stability" << endl;
mass = (area * 135) / 1000;
cout << "Mass in kg: " << mass << endl;
gravitational_pull = mass * 9.8;
cout << "Gravitational pull is: " << gravitational_pull << endl;
}
|