2009-06-23 15:45:45
Alan
C++ Class
@說明
-CD.講義
-c++ reference (http://www.cppreference.com/wiki/)
-set up Dev-C++ V4.9.9.2
-Visual C++ 6.0*1 & MSDN*2 (建議使用的版本)
-*.c *.cpp *.cc 為文件檔 => compiler (轉譯) => *.obj *.o (機械碼 2進位) + *.lib (Library) => Link => *.exe *.a
@Start C++
-new =>project => Console => new file
-new C++ form:
#include
#include
using namespace std; //**********************物件導向用
int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
-Execute(轉譯成*.obj可除錯)
-Compiler (Ctrl+F9)
-Run (Ctrl+F10)
-程式結構
#include
#include
using namespace std;
//-----------------------------------------------註解說明
main() //主程式結構
{
//system 執行MSDOS指令
system("dir"); //執行MSDOS指令
system("date"); //執行MSDOS指令
system("time"); //執行MSDOS指令
system("PAUSE"); //暫停 --執行MSDOS指令
}
/*
註解說明
*/
//return 結束程式
//printf f: function 印表功能或印表副程式(Subroutine)或印表函數(function)
//%d 表整數 %f表浮點數
// 目前32bit電腦只能處理20億以內,超過即會出現錯誤答案,但電腦無法找出錯誤.2進位中,int宣告為4個byte整數(-2147483648~ +2147483648 ), short 2個byte整數, char 1個byte整數=8bit=1+7bit
//overflow溢位
-HW from:
-CD.講義
-c++ reference (http://www.cppreference.com/wiki/)
-set up Dev-C++ V4.9.9.2
-Visual C++ 6.0*1 & MSDN*2 (建議使用的版本)
-*.c *.cpp *.cc 為文件檔 => compiler (轉譯) => *.obj *.o (機械碼 2進位) + *.lib (Library) => Link => *.exe *.a
@Start C++
-new =>project => Console => new file
-new C++ form:
#include
#include
using namespace std; //**********************物件導向用
int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
-Execute(轉譯成*.obj可除錯)
-Compiler (Ctrl+F9)
-Run (Ctrl+F10)
-程式結構
#include
#include
using namespace std;
//-----------------------------------------------註解說明
main() //主程式結構
{
//system 執行MSDOS指令
system("dir"); //執行MSDOS指令
system("date"); //執行MSDOS指令
system("time"); //執行MSDOS指令
system("PAUSE"); //暫停 --執行MSDOS指令
}
/*
註解說明
*/
//return 結束程式
//printf f: function 印表功能或印表副程式(Subroutine)或印表函數(function)
//%d 表整數 %f表浮點數
// 目前32bit電腦只能處理20億以內,超過即會出現錯誤答案,但電腦無法找出錯誤.2進位中,int宣告為4個byte整數(-2147483648~ +2147483648 ), short 2個byte整數, char 1個byte整數=8bit=1+7bit
//overflow溢位
-HW from:
下一篇:C++ use IF