2023年計算機等級二級C語言考點歸納 二

2021-09-22 17:27:47 字數 2539 閱讀 3146

2012計算機等級:c語言函式大全(n,o開頭)

void normvideo(void );

選擇正常亮度字元。

將文字屬性(前景和背景)置為啟動程式時它所具有的值,來選擇標準字元。

void nosound(void );

關閉由呼叫 sound而發聲的揚聲器。

函式名: open

功能: 開啟乙個檔案用於讀或寫

用法: int open(char *pathname, int access[, int permiss]);

程式例:

#include

#include

#include

#include

int main(void)

write(handle, msg, strlen(msg));

close(handle);

return 0;

}函式名: outport

功能: 輸出整數到硬體埠中

用法: void outport(int port, int value);

程式例:

#include

#include

int main(void)

函式名: outportb

功能: 輸出位元組到硬體埠中

用法: void outportb(int port, char byte);

程式例:

#include

#include

int main(void)

函式名: outtext

功能: 在視區顯示乙個字串

用法: void far outtext(char far *textstring);

程式例:

#include

#include

#include

#include

int main(void)

midx = getmaxx() / 2;

midy = getmaxy() / 2;

/* move the c.p. to the center of the screen */

moveto(midx, midy);

/* output text starting at the c.p. */

outtext(「this 」);

outtext(「is 」);

outtext(「a 」);

outtext(「test.」);

/* clean up */

getch();

closegraph();

return 0;

}函式名: outtextxy

功能: 在指定位置顯示一字串

用法: void far outtextxy(int x, int y, char *textstring);

程式例:

#include

#include

#include

#include

int main(void)

midx = getmaxx() / 2;

midy = getmaxy() / 2;

/* output text at the center of the screen*/

/* note: the c.p. doesn』t get changed.*/

outtextxy(midx, midy, 「this is a test.」);

/* clean up */

getch();

closegraph();

return 0;

}14.1 結構體與共用體型別資料的定義方法和引用方法

1.結構體型別資料的定義方法:可以採用下面三種方法來定義:

(1)先定義結構體型別再定義變數名

先定義乙個結構體型別,一般形式為:

struct 結構體名 ;

(2)在定義型別的同時定義變數:一般形式為:

struct 結構體名

變數名列表;

(3)直接定義結構型別變數:一般形式:

struct

變數名列表;

即不出現結構體名。

2.結構體型別變數的引用:在定義了結構體變數後,可以採用下列方法引用結構體型別的變數:

結構體變數名。成員名

這裡″。″是成員(分量)運算子,它在所有的運算子中優先順序最高。

3.共用體型別變數的定義形式為:

union共用體名

變數列表;

4.共用體變數的引用:可以用下面的形式引用共用體變數:

共用體變數名。成員名

14.2 用指標和結構體構成鍊錶,單向鍊錶的建立、輸出、刪除與插入

1.鍊錶是一種常用的重要的資料結構,它是動態地進行儲存分配的一種結構。

2.所謂建立鍊錶是指從無到有地建立起乙個鍊錶,即乙個乙個地輸入各結點資料,並建立起前後相鏈的關係。

3.所謂輸出鍊錶就是將鍊錶各結點的資料依次輸出。

4.所謂刪除鍊錶事實上就是刪除鍊錶中的某個結點。

5.所謂插入鍊錶就是在鍊錶中某個位置插入乙個或幾個結點.

計算機等級考試二級C語言模擬試題

2010年9月計算機等級考試二級c語言模擬試題 三 1 筆試部分 一 選擇題 1.對下面程式描述正確的一項是 每行程式前面的數字表示行號 main int i for i 0 i 3 i scanf d a i for i 1 i 3 i a 0 a 0 a i printf f n a 0 a.沒...

2023年計算機二級C語言題庫找題目錄

找題目錄 第01套 int fun 1 std 第02套 void writetext file 1 第03套 fprintf 1 d f n 第04套if fs fopen source,1 第05套 s data 1 q 2 第06套 t t 1 第07套 free 1 第08套 while p...

計算機二級C語言複習

第一部分 c語言知識複習資料 第一章 c語言基本知識 考點1 c程式 用c語言編寫的程式稱為c語言源程式,源程式檔案的字尾名為 c 源程式經編譯後生成字尾名為 obj 的目標檔案,再把目標檔案與各種庫函式連線起來,生成 exe 可執行檔案。c語言有三種基本結構 順序結構 選擇結構 迴圈結構。考點2 ...