level 3
淋雨502
楼主
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int i,j,k,flag;
i=2;
do
{
flag=1;
k=sqrt(i);
j=2;
do
{
if(i%j==0)
{
flag=0;
break;
}
j++;
}while(j<=k);
if(flag)
cout<<i<<"是质数"<<endl;
i++;
}
while(i<=100);
return 0;
}
1>------ 已启动生成: 项目: qwe, 配置: Debug Win32 ------
1>正在编译...
1>fff.cpp
1>f:\c语言作业\qwe\qwe\fff.cpp(11) : error C2668: “sqrt”: 对重载函数的调用不明确
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(581): 可能是“long double sqrt(long double)”
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(533): 或 “float sqrt(float)”
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(128): 或 “double sqrt(double)”
1> 试图匹配参数列表“(int)”时
1>生成日志保存在“file://f:\c语言作业\qwe\qwe\Debug\BuildLog.htm”
1>qwe - 1 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
看不懂怎么改啊 新手
2012年02月25日 04点02分
1
#include<cmath>
using namespace std;
int main()
{
int i,j,k,flag;
i=2;
do
{
flag=1;
k=sqrt(i);
j=2;
do
{
if(i%j==0)
{
flag=0;
break;
}
j++;
}while(j<=k);
if(flag)
cout<<i<<"是质数"<<endl;
i++;
}
while(i<=100);
return 0;
}
1>------ 已启动生成: 项目: qwe, 配置: Debug Win32 ------
1>正在编译...
1>fff.cpp
1>f:\c语言作业\qwe\qwe\fff.cpp(11) : error C2668: “sqrt”: 对重载函数的调用不明确
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(581): 可能是“long double sqrt(long double)”
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(533): 或 “float sqrt(float)”
1> c:\program files\microsoft visual studio 9.0\vc\include\math.h(128): 或 “double sqrt(double)”
1> 试图匹配参数列表“(int)”时
1>生成日志保存在“file://f:\c语言作业\qwe\qwe\Debug\BuildLog.htm”
1>qwe - 1 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
看不懂怎么改啊 新手