运行VC++,提示出错.懂的人教下我,小弟叩谢拉

yinhang0914 2007-12-26 09:31:20
我用运行的程序是,很简单,就是求两个数中最大的一个 ,程序本身没有问题.
#include <iostream.h>

vodi main()

{ float a,b;

cout<<"Enter two float number :"<<endl;

cin>>a>>b;

if(a>b)

cout<<"max is :"<<a<<endl;

else

cout<<"max is :"<<b<<endl;
}

运行程序提示的结果提示出错,它的提示是
Compiling...
pp.cpp
e:\program files\microsoft visual studio\myprojects\pp\pp.cpp(3) : error C2146: syntax error : missing ';' before identifier 'main'
e:\program files\microsoft visual studio\myprojects\pp\pp.cpp(3) : error C2501: 'vodi' : missing storage-class or type specifiers
e:\program files\microsoft visual studio\myprojects\pp\pp.cpp(3) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.

pp.exe - 1 error(s), 0 warning(s)

大哥大姐帮忙拉,小弟谢谢拉!!!
...全文
105 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
陈奇113 2007-12-27
  • 打赏
  • 举报
回复
你是不是工程建错了?
wuyu637 2007-12-27
  • 打赏
  • 举报
回复
工程的创建方式错了。。

你创建的是一个win32application。。


而我们给你的代码应该是一个console控制台命令程序的。。。


重新建一个工程,新建的时候选win 32 console application..
不是win32 application...!!!!
yinhang0914 2007-12-27
  • 打赏
  • 举报
回复
说明一下,我用的是VC++6.0中文版/
yinhang0914 2007-12-27
  • 打赏
  • 举报
回复
把程序更改如下,还是出错
#include <iostream.h>

void main()
{ float a,b;

cout<<"Enter two float number :"<<endl;

cin>>a>> b;

if(a>b)

cout<<"max is :"<<a<<endl;

else

cout<<"max is :"<<b<<endl;
}
提示的错误是
Compiling...
ff.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/ff.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
wenjun1130 2007-12-26
  • 打赏
  • 举报
回复
#include <iostream.h>
void main()
{
float a,b;
cout <<"Enter two float number :" <<endl;
cin>> a>> b;
if(a>b) cout <<"max is :" <<a <<endl;
else cout <<"max is :" <<b <<endl;
}
yinhang0914 2007-12-26
  • 打赏
  • 举报
回复
一楼的兄弟啊,我把你的结果试拉下,还是不行啊!!!
yinhang0914 2007-12-26
  • 打赏
  • 举报
回复
哦 ,不好意思 ,刚打错拉 我在运行的程序里面打的是Void .不好意思,2楼的朋友
wuyu637 2007-12-26
  • 打赏
  • 举报
回复
估计是你把void 打成vodi了。。
wuyu637 2007-12-26
  • 打赏
  • 举报
回复
#include "stdafx.h"
#include <iostream>
using namespace std;
#include <iostream>

void main()

{ float a,b;

cout <<"Enter two float number :" <<endl;

cin>> a>> b;

if(a> b)

cout <<"max is :" << a <<endl;

else

cout <<"max is :" <<b <<endl;
}

24,860

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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