summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
blob: f045f297338f4e0b1010f56c0aa4df6da790de47 (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
50
51
52
53
54
55
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>

using namespace std;

using std::cout;
using std::cin;
using std::endl;
 
int main()
{
    float width, length, area, ratio, gravitational ;
    const int mass = 135;
   
    cout << "Enter width (cm) : ";
    cin >> width;   
    while (width < 1 || width > 400)
    {
        cout << "value must be between 1 and 400" << endl;
        cout << "Enter width (cm) : ";
        cin >> width;
    }
    cout << "Enter length (cm) : ";
    cin >> length;
    while (length < 1 || length > 400)
    {
        cout << "value must be between 1 and 400" << endl;
        cout << "Enter length (cm) : ";
        cin >> length;
    }



    cout << "width: ";
    cout << width<< endl;
    cout << "length: ";
    cout << length << endl;
    
    area = (width * length / 2) / 10000;
    cout << "area (m) : ";
    cout << area << endl;

    ratio = width / length; 
    cout << "ratio: ";
    cout << ratio << endl;
    if (ratio >= 1)
        cout << "a lower aspect ratio would provide more stability" << endl;

    gravitational = mass * area;
    cout << "gravitational: ";
    cout << gravitational << endl;
}