我的第一个C++程序,

来源:百度知道 编辑:UC知道 时间:2024/05/09 04:05:52
#include <iostream.h>
//
//
//
int main() {
cout << "OK" << endl;
return (0);
}
就这个,简单不能再简了,为什么总是说不对呢?用netbean, 编译器是cygwin
谁可以告诉我是怎么回事?
在 E:\NetBeanSpace\MyFirstCpp 中运行 "make.exe -f Makefile CONF=Debug"

make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/e/NetBeanSpace/MyFirstCpp'
mkdir -p build/Debug/Cygwin-Windows
g++.exe -c -g -o build/Debug/Cygwin-Windows/newmain.o newmain.cc
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31,
from newmain.cc:8:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/backward_warning.h:32:2: warning: #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

可以改为要返回值的
#include <iostream>
using namespace std;
int main()
{
cout << "OK" << endl;
return 0;
}
也可以改为不要返回值的
#include <iostream.h>
void main()
{
cout << "OK" << endl;
}

至于return 0 ;的括号可要可不要 效果是一样的
而你的程序 是没有什么错误的
你再试试 可能是你的c++程序没有装完整的缘故
我在我的电脑上运行是正确的

#include <iostream.h>
//
//
//
int main() {
cout << "OK" << endl;
return 0;
}

后面一句应该是return 0

你加个括号干嘛?

return 0;