How do I perfect this? :D

A fairly simple program used to solve the missing length of a right triangle! It works perfectly fine but I would like to know what i could do to the code to make it
a) work better
b) shorter
make any changes to the code that you want, just try to make any huge changes.
THANKS! :D
(note* I know theres a lot of unnecessary spaces, but give me a break! this thread is for beginners.)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include <math.h>
#include <cstdlib>

using namespace std;

int main()

{
    cout << "Production of SOCIALISTICmeow\n";
    cin.ignore();
    cout << " Find the missing side length of a Right triangle.";
    cin.ignore();

    char restart;
beginning:
    long double a , b, c;
cout << "Enter your A value (if none, enter 0):";
cin >> a;

cout << "Enter your B value (if none, enter 0):";
cin >> b;

cout << "Enter your C value (if none, enter 0):";
cin >> c;



    long double A_value;
    A_value= sqrt(c*c - b*b);



    long double B_value;
    B_value= sqrt(c*c - a*a);



    long double C_value;
    C_value= sqrt((a*a) + (b*b));



    if(a == 0)
    {
        cout << "A equals:";
        cout << A_value;
        cin.ignore();

    }
    if(b == 0)
    {
        cout << "B equals:";
        cout << B_value;
        cin.ignore();

    }
    if(c == 0)
    {
        cout << "C equals:";
        cout << C_value;
        cin.ignore();
    }

    cout << "\nWould you like repeat process? (Y/N):";
    cin >> restart;

    if(restart == 'Y' || restart == 'y')
    {
        goto beginning;
    }

    cout << "SEE YA!";
    cin.sync();
    cin.ignore();
    return 0;





}
Improvement suggestions:

1)Replace the goto by a loop. Makes the whole thing easier to read.
2)Check if the values are actually valid before using them. (means, check whether the 3 sides actually make a triangle).
3)Check your input for fails before doing the next input.
4)Don't depend on side C being the longest.
5)replace math.h by cmath. math.h is outdated.
Topic archived. No new replies allowed.