文章

顯示從 10月, 2015 起發佈的文章

Install Eclipse CDT

圖片
Environment Eclipse CDT - Luna MinGW -  4 Dec 2013 (x86 compiler) Install and Create C\C++ project      Eclipse CDT with MinGW  1. Install JRE , Eclipse CDT  and MinGW 2. Add c:\MinGW\bin to Path in environment variable 3. Copy mingw32-make . ex eand name as make.exe 4. Run Eclipse Window->Peferences->C/C++ -> New C\C++ Project Wizard -> Makefile Project 5. Choose PE Windows Parser,  Apply,  OK Create C\C++ Project 1. File -> New -> Project -> -> C\C++ -> Choose C Project of C++ Project 2. Empty Project, MinGW GCC After Created a Project 3. Window -> Show View -> Make Target 4. Right Click Project -> New 5. type target name 6. Build and Run ! Reference (Chinese) http://nknush.kh.edu.tw/~johnsirhp/Eclipse+CDT+MinGW.htm http://www.dotblogs.com.tw/shunnien/archive/2013/12/19/135202.aspx http://shaocian.blogspot.hk/2012/11/eclipse-cc-cdt-mingw.html

[Error Log|Solved] strcpy clear source

圖片
eclipse CDE MinGW From Lab sample code. answer_word is clear although it is const char*. Reason:  const  char answer_word [ ] =  {  's', 'e', 'm', 'e', 's', 't', 'e', ' r '  } ; // the secret word without  '\0' at the end of string. Solution  : add '\0' at the end when initializing string const  char answer_word [ ] =  {  's', 'e', 'm', 'e', 's', 't', 'e', ' r ', '\0'  } ; #include " stdio . h" #include < iostream > #include < cstdlib > #include < ctime > #include "string . h" using namespace std ; /* * The word guessing game */ /* * display ( const char [ ], int): Print out the character array in a single line. */ void display_word ( const char word [ ], int size) {  // TODO 1: print the word   for ( i