I am transfering from Java to C and C++ and i am having a problem with easiest tasks like this so please help me if you can:
#include<stdio.h>
#include<math.h>
void main()
{
int a, h;
double interres;
double base;
printf("Input a: ");
scanf("%d", &a);
printf("Input height h: ");
scanf("%d", &h);
base =(a^2 * sqrt(3))/ 4;//line 13
interres = a ^ 2 * sqrt(3);//line 14
printf("(%d^2*sqrt(3))/4=(%d^2*%f)/4=(%f*%f)/4=%f/4=%f cm",a,a,sqrt(3),a^2,sqrt(3),interres,base);
}
And I get constantly errors:
error C2297: '^': illegal, right operand has type 'double' line 13
error C2297: '^': illegal, right operand has type 'double' line 14
warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.