-2
Error: invalid operands of types 'float' and 'float' to binary 'operator^'錯誤:無法操作數的類型'浮動'和'浮動'二進制'運算符^'
有人可以告訴我爲什麼我得到這個錯誤?
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int a,w;
float P,M,y,i,n;
for(a=1;a=2;)
{
printf("Enter the value of Pricipal \n");
scanf("%f",&P);
printf("Enter the value of yearly interest rate \n");
scanf("%f",&y);
i=y/12;
printf("Enter Term in years \n");
scanf("%d",&w);
n=w*12;
M=(P*i*((1+i)^n))/(((1+i)^n)-1);
printf("Monthly Payment is %f \n",M);
}
}
你有類似'1.2^2.0'在你的代碼? – user463035818
請顯示您的代碼 – atb
您是否在尋找['pow'](http://en.cppreference.com/w/cpp/numeric/math/pow)? –