|
Major Member
|
諸位高手大大好唷
小弟要有問題要發問了
仍然請經驗老到的大大們幫小弟解惑唷
(1)小弟打了一段程式碼:
#include "stdafx.h"
#include "iomanip.h"
#include "iostream"
using namespace std;
int main(int argc, char* argv[])
{
int i=0;
cout <<endl<<"\t\t\t"<<"此為公英制單位的轉換表"<<"\n\n\n";
cout <<setw(3)<<"|"
<<setw(16)<<"公尺"
<<setw(16)<<"英寸"
<<setw(16)<<"英呎"
<<setw(16)<<"英哩"
<<endl;
for (i=0;i<=10;i++)
cout <<"-------";
cout <<endl;
cout <<setw(3)<<"|"
<<setw(16)<<"1000"
<<setw(16)<<"39370"
<<setw(16)<<"3280.83"
<<setw(16)<<"0.62136"
<<endl;
cout <<setw(3)<<"|"
<<setw(16)<<"1"
<<setw(16)<<"39.370"
<<setw(16)<<"3.28083"
<<setw(16)<<"0.0006214"
<<"\n\n";
return 0;
}
這個結果是Compile不過的
因為原本的程式碼中不含"using namespace std;"
這一行,但卻能正常執行
後來忘記加這一行,加上去之後compile反而過不了了
小弟想好久都不知為什麼?
(2)long,double是屬於什麼樣的資料型態啊?
跟int ,float差別在哪兒呢?
請多指教唷
|