花之慶次 2010-7-2 08:05
想請教一下一個比較簡單C++程式問題, 為什麼不能執行
[font=Tahoma, Verdana][size=13px]以下程式是這樣的:
#include<iostream.h>
#include<cstdlib.h>
int main(void)
{
float number2=98.6;
cout << number2 << endl;
system("pause");
return 0;
}
而執行結果時所指出的問題是這樣的
/Documents and Settings/hi/桌面/test.cpp C:\Documents and Settings\hi\桌面\C iostream.h: No such file or directory.
/Documents and Settings/hi/桌面/test.cpp C:\Documents and Settings\hi\桌面\C cstdlib.h: No such file or directory.
C:\Documents and Settings\hi\桌面\test.cpp In function `int main()':
6 C:\Documents and Settings\hi\桌面\test.cpp `cout' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
7 C:\Documents and Settings\hi\桌面\test.cpp `system' undeclared (first use this function)
有沒有解決方法???[/size][/font]
jayzhou_2046 2010-7-2 11:20
改成:
#include <iostream>
#include <cstdlib>
using namespace std;
int main(viod)
...
FuckForever 2010-7-11 20:28
可能是头文件路径不对,
旧时的C++用.h的文件
现在已被淘汰了