So I'm making a simple calculator program on the Windows Form Application of C++. Nevertheless, I'm stuck on the exponents, factorial, and square root part. In my System32 Console calculator, these were the codes I use for the exponent, factorial, and respectively, while I just used the sqrt function of math.h library for the square root:
cout<<"Ingrese su base : ";
cin>>VAL1;
cout<<"\n Ingrese su potencia : ";
cin>>VAL2;
ACUMULADO=VAL1;
if (VAL2==1)
{
RES=VAL1;
cout<<"\n Su respuesta es : "<<RES <<endl;
}
else
if (VAL2==0)
{
RES=1;
cout<<"\n Su respuesta es : "<<RES <<endl;
}
else
if (VAL2>1)
{
for (int CONT=2;CONT<=VAL2;CONT+=1)
{
ACUMULADO*=VAL1;
}
}
double VA;
double FACT=1;
cout<<"Ingrese factorial : ";
cin>>VA;
for (int CONT=1;CONT<=VA;CONT++)
{
FACT*=CONT;
}
I am lost on how to implement this codes for the functions inside the Windows Form, and I have no idea how to correctly implement the #include math.h library inside the Windows Form, hence unable to use the square root function. Help?