推介:| 修理頂蓬布 | Mediator course | Hypnosis course | Dream Interpretation | NLP | English course |

發新話題
打印

[疑難] 想請教一下一個比較簡單C++程式問題, 為什麼不能執行

想請教一下一個比較簡單C++程式問題, 為什麼不能執行

以下程式是這樣的:

#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)


有沒有解決方法???

TOP

改成:
#include <iostream>
#include <cstdlib>
using namespace std;
int main(viod)
...
IT代工/鎗手一名!
小弟並唔平, 但絕唔係貴!

TOP

<iostream>
不要.h

TOP

可能是头文件路径不对,
旧时的C++用.h的文件
现在已被淘汰了

TOP

提示: 作者被禁止或刪除 內容自動屏蔽

TOP

發新話題


重要聲明:本討論區是以即時上載留言的方式運作,本網站對所有留言的真實性、完整性及立場等,不負任何法律責任。而一切留言之言論只代表留言者個人意見,並非本網站之立場,用戶不應信賴內容,並應自行判斷內容之真實性。於有關情形下,用戶應尋求專業意見(如涉及醫療、法律或投資等問題)。由於本討論區受到「即時上載留言」運作方式所規限,故不能完全監察所有留言,若讀者發現有留言出現問題,請聯絡我們。本討論區有權刪除任何留言及拒絕任何人士上載留言,同時亦有不刪除留言的權利。切勿撰寫粗言穢語、誹謗、渲染色情暴力或人身攻擊的言論,敬請自律。本網站保留一切法律權利。


Copyright 1997- Xocat. All Right Reserved.