Code:
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
int A, B, C, A1, B1, C1, A2, B2, C2, A3, B3, C3, A4, B4, C4 ;
cout << "Welcome to Maths Cheat. A program developed by Kej. \nI hope it helps! \n";
cout << "Pythag mode has been initialized. \nInput the variables in the form of A B C, with either B or C as 0 dependent\n on whether the hypotenuse is known. \n";
cout << "Now enter your variables in the form A B C Then press enter.";
cin >> A >> B >> C;
cout << "A = " << A <<"\n";
cout << "B = " << B <<"\n";
cout << "C = " << C <<"\n";
if (C == 0){
C1 = pow (A,2);
C2 = pow (B,2);
C3 = C1 + C2;
C4 = sqrt (C3);
cout << "Calculation in progess \nC = " << C4;
}
}
Run this program why does C4 = 4 if you input 2 4 0, and not 5 as it should be?
Only just learning about math functions.