C ++代码编译不正确

时间:2014-11-25 07:33:45

标签: c++

我有窗口8,我的代码在开发c ++ ..但我有一些错误..请帮我删除它们

代码是:

#include <iostream>
#include<conio.h>

using namespace std;

main()
{

int AmerAge, AmaraAge;
cout<<"please enter AmerAge";
cin<<AmerAge;
cout<<"please enter AmaraAge";
cin<<AmaraAge;

if(AmerAge>AmaraAge)
cout<<"Amer is older than amara";
}

编译错误

  

52 0 c:\ program files(x86)\ dev-cpp \ mingw32 \ lib \ gcc \ mingw32 \ 4.8.1 \ include \ c ++ \ string在c:\ program files(x86)\ dev-中包含的文件中CPP \的mingw32 \ lib中\ GCC \的mingw32 \ 4.8.1 \包括\ C ++ \串

1 个答案:

答案 0 :(得分:1)

首先,

cin << AmerAge;

应该是:

cin >> AmerAge;

我记得这个有记忆辅助工具:你输入数据变量cin >> var,你输出来自cout << var


其次,conio不是C ++标题,它甚至不是C标题。

这是来自Borland(或Invogue或Enchilada或他们现在称之为的任何东西)过去的爆炸。

它在印度教育机构中没有任何外部任务,尽管它们有更多的现代(以及免费和符合标准)选项,但它们似乎更喜欢它。它也没有抱怨过,比如没有从main()指定一个返回类型。


最后,您可能希望返回并重新阅读安装MinGW时应注意的所有警告。

你知道,关于安装到一个带有空格的路径以及它如何可能搞砸了大部分工具链的那些: - )

相关问题