devc++怎么用,刚下了个怎么很难上手啊?

nuke505 2005-03-22 10:57:55
//--------------------------------
#include<iostream.h>
//-------------------------------
void main()
{
int a,b;
cout <<"请输入两个数: ";
cin >> a >>b;
int min=a>b ? b : a;
int t;
for(int i=2;i<=min;i++)
if(a%i==0 && b%i==0)
t=i;

if (t==0)
cout << "no greatest command divisor.\n";
else
cout <<"the greatest command divisor is" << t ;
}

这个程序在VC6。0下能完全运行,但用DEVC++编译怎么这么多错误:
31 d:\Dev-Cpp\include\c++\backward\iostream.h
In file included from d:/Dev-Cpp/include/c++/backward/iostream.h
2 G:\C++exercises\7.cpp
from G:/C++exercises/7.cpp
2 d:\Dev-Cpp\include\c++\backward\backward_warning.h:32
#warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
5 G:\C++exercises\7.cpp
`main' must return `int'



...全文
671 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjyu88 2005-03-22
  • 打赏
  • 举报
回复
虽然结贴了...但还说一说..
这个程序在VC6。0下能完全运行,但用DEVC++编译怎么这么多错误:
就说明VC6.0不如DEV C++~~
jilu0002 2005-03-22
  • 打赏
  • 举报
回复
devc++的标准库非常快,效率好像比vc还高,用到后面就爽了
cxn0808 2005-03-22
  • 打赏
  • 举报
回复
同意 fanofvc(潜心研究C++) 的看法
强烈建议使用C++标准写法,去掉.h ,加上命名空间
yangyoung 2005-03-22
  • 打赏
  • 举报
回复
返回值return 0;
和名字空间问题:using namespace std;
panwai 2005-03-22
  • 打赏
  • 举报
回复
t没有初始化吧
fanofvc 2005-03-22
  • 打赏
  • 举报
回复
vc不标准,以下是标准的c++写法,保证通过。
#include<iostream>
using namespace std;
//-------------------------------
int main()
{
int a,b;
cout <<"请输入两个数: ";
cin >> a >>b;
int min=a>b ? b : a;
int t;
for(int i=2;i<=min;i++)
if(a%i==0 && b%i==0)
t=i;

if (t==0)
cout << "no greatest command divisor.\n";
else
cout <<"the greatest command divisor is" << t ;
return 0;
}
superc1z 2005-03-22
  • 打赏
  • 举报
回复
Warning 是警告不要紧的
superc1z 2005-03-22
  • 打赏
  • 举报
回复
return 0;
这句没写
llmsn 2005-03-22
  • 打赏
  • 举报
回复
用VC++吧,不会太难懂调试一般的算法的话.

64,649

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧