1 / 16

Console I/O

Console I/O. 授課: 張朝麟 日期: 2009/5/6. Outline. 學習目標 在 Dec C++ 安裝 Conio2.0 Conio2.h 移動游標 LAB8 HW8. 學習目標. 學會 Dev C++ 中讓一般輸出內容能顯示彩色文字 學會使用方向鍵控制游標位置. 在 Dec C++ 安裝 Conio2.0. 下載 conio2.h 的安裝檔案 conio-2.0-1mol.DevPak 將下載下來的檔案進行安裝,安裝完可以看到 Conio2.0 被安裝完成

xuan
Download Presentation

Console I/O

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Console I/O 授課:張朝麟 日期:2009/5/6

  2. Outline • 學習目標 • 在Dec C++安裝Conio2.0 • Conio2.h • 移動游標 • LAB8 • HW8

  3. 學習目標 • 學會Dev C++中讓一般輸出內容能顯示彩色文字 • 學會使用方向鍵控制游標位置

  4. 在Dec C++安裝Conio2.0 • 下載conio2.h的安裝檔案 • conio-2.0-1mol.DevPak • 將下載下來的檔案進行安裝,安裝完可以看到Conio2.0被安裝完成 • 此時還是無法正常使用textcolor的程式指令,因此還需要一些步驟才能使功能正常運作 • 開啟Dev C++程式,在功能表選單中選擇[工具]->[編譯器選項] • 在[編譯器]中的[連結器命令列中加入以下命令]文字框區域中輸入-lconio,然後前面[打勾]即可

  5. Conio2.h(1/4) • void gotoxy (int x, int y)  • Moves cursor to the specified position. • int wherex (void)  • Reads the cursor X position. • int wherey (void) • Reads the cursor Y position.

  6. Conio2.h(2/4) • void cputsxy (int x, int y, char *str)  • Puts string at the specified position. • void putchxy (int x, int y, char ch)  • Puts char at the specified position.

  7. Conio2.h(3/4) • void textbackground (int color)  • Sets text background color. • void textcolor (int color)  • Sets text foreground color. • void clrscr (void) • Clears whole screen.

  8. Conio2.h(4/4) • enum  COLORS { BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN,LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE} • 其他Function • http://conio.sourceforge.net/docs/html/conio2_8h.html

  9. VC • 如何產生彩色文字請參考 • http://support.microsoft.com/kb/319234/zh-tw • 其他Function • http://msdn.microsoft.com/en-us/library/ms682073.aspx

  10. UNIX • 請參考BBS Programming版 • 第35篇 => curses 清螢幕 • 第42篇 ◇ Moving Hanoi

  11. ex1

  12. 使用方向鍵控制游標位置 • 上 • ACSII: 224 72 • 下 • ACSII: 224 80 • 左 • ACSII: 224 75 • 右 • ACSII: 224 77 • Esc • ACSII: 27

  13. ex2

  14. LAB8

  15. HW8 • 程式功能 • 畫出一顆聖誕樹,並在樹旁邊寫一些話。(聖誕樹需是彩色,額外的話也須是彩色,以上兩點須由動畫呈現。)

  16. HW8

More Related