我有以下代码,我在这个等式中得到错误:
v=p*(1+r)^n.
Run Code Online (Sandbox Code Playgroud)
请帮我找出这个错误的原因.
# include <iostream>
# include <limits>
using namespace std;
int main()
{
float v,p,r;
int n;
cout<<"Enter value of p:";
cin>>p;
cout<<"Enter value of r:";
cin>>r;
cout<<"Enter value of n:";
cin>>n;
v=(p)*(1+r)^n; // here i am getting error message as "expression must have integral or enum type"
cout<<"V="<<v;
std::cin.ignore();
std::cin.get();
}
Run Code Online (Sandbox Code Playgroud) 嗨,我有以下代码
我收到警告"警告C4028:正式参数1与声明不同"
我不知道我哪里出错了.我认为我的参数声明是正确的,但请帮助我.
# include <stdio.h>
# include <conio.h>
# include <math.h>
main()
{
int x,y(),z,sqrt(int),cube(int);
printf("Enter any number:");
scanf("%d",&x);
z=(x>y() ? sqrt(x):cube(x));
printf("%d",z);
getche();
return 0;
}
int sqrt(int a)
{
printf("Square:");
return(a*a);
}
int cube(int b)
{
printf("Cube:");
return(b*b*b);
}
int y()
{
return(10);
}
Run Code Online (Sandbox Code Playgroud)