程式碼如下 但他卻說 沒有 iostream.h 所以 狂CE 請問是哪裡有問題?
在Dev 裡都ok 說
#include <iostream.h> int main() { int year,a,b,c; while((cin >> year)==1) { if((((year%4)==0) && ((year%100)!=0)) || ((year%400)==0)) { cout << "閏年\n" ; } else { cout << "平年\n" ; } } return 0; }
/code_1592875.cpp:1:22: error: iostream.h: 沒有此一檔案或目錄 /code_1592875.cpp: In function ‘int main()’: /code_1592875.cpp:5: error: ‘cin’ was not declared in this scope /code_1592875.cpp:9: error: ‘cout’ was not declared in this scope /code_1592875.cpp:13: error: ‘cout’ was not declared in this scope
程式碼如下 但他卻說 沒有 iostream.h 所以 狂CE 請問是哪裡有問題?
在Dev 裡都ok 說
#include int main() { int year,a,b,c; while((cin >> year)==1) { if((((year%4)==0) && ((year%100)!=0)) || ((year%400)==0)) { cout << "閏年\n" ; } else { cout << "平年\n" ; } } return 0; }
/code_1592875.cpp:1:22: error: iostream.h: 沒有此一檔案或目錄 /code_1592875.cpp: In function ‘int main()’: /code_1592875.cpp:5: error: ‘cin’ was not declared in this scope /code_1592875.cpp:9: error: ‘cout’ was not declared in this scope /code_1592875.cpp:13: error: ‘cout’ was not declared in this scope
因为标准的写法是
#include <iostream>