大家帮忙运行一下好吗,请问可不可以运行,我刚学c++,这个运行不了,说是少什么文件
来源:百度知道 编辑:UC知道 时间:2024/06/30 14:46:55
#include<iostream.h>
double power (double x,int n);
void main(void)
{
int i;
int value=0;
char ch;
cout <<"enter an 8 bir binary number ";
for (i=7;i>=0;i--)
{
cin>>ch;
if (ch =='1')
value =+ int(power (2,1));
}
cout <<"decimal value is "<<value<<endl;
}
double power (double x,int n)
{
double val =1.0;
while (n--)
val *=x;
return(val);
} ,我想确认是不是我的vc++有问题
double power (double x,int n);
void main(void)
{
int i;
int value=0;
char ch;
cout <<"enter an 8 bir binary number ";
for (i=7;i>=0;i--)
{
cin>>ch;
if (ch =='1')
value =+ int(power (2,1));
}
cout <<"decimal value is "<<value<<endl;
}
double power (double x,int n)
{
double val =1.0;
while (n--)
val *=x;
return(val);
} ,我想确认是不是我的vc++有问题
怎么不把错误的提示也帖上来? 在VC里面运行试了一下,没有问题。
File->New->Files->C++ Source File 然后把代码帖上去。
运行:
--------------------Configuration: dsf - Win32 Debug--------------------
Compiling...
dsf.cpp
Linking...
dsf.exe - 0 error(s), 0 warning(s)
结果 :
entry an 8 bir binary number
看一下是不是和你的一样。
我这里运行没有问题
源代码没有问题 在我的VC++6.0上可以运行,建议检查你的VC++,或者重新安装一个。
#include<iostream.h>
学过这个很长时间了
基本上忘记了
好像是不是这个的前面还是后面还得在写点什么??