c语言库函数(编辑修改稿)内容摘要:
(i=0。 i10。 i++) putchar(HORIZ)。 putchar(RIGHT_TOP)。 putchar(39。 \n39。 )。 /* draw the middle */ for (i=0。 i4。 i++) { putchar(VERT)。 for (j=0。 j10。 j++) putchar(39。 39。 )。 putchar(VERT)。 putchar(39。 \n39。 )。 } /* draw the bottom */ putchar(LEFT_BOT)。 for (i=0。 i10。 i++) putchar(HORIZ)。 putchar(RIGHT_BOT)。 putchar(39。 \n39。 )。 return 0。 } 函数名 : putenv 功 能 : 把字符串加到当前环境中 用 法 : int putenv(char *envvar)。 程序例 : include include include include include int main(void) { char *path, *ptr。 int i = 0。 /* get the current path environment */ ptr = getenv(PATH)。 /* set up new path */ path = malloc(strlen(ptr)+15)。 strcpy(path,PATH=)。 strcat(path,ptr)。 strcat(path,。 c:\\temp)。 /* replace the current path and display current environment */ putenv(path)。 while (environ[i]) printf(%s\n,environ[i++])。 return 0。 } 函数名 : putimage 功 能 : 在屏幕上输出一个位图 用 法 : void far putimage(int x, int y, void far *bitmap, int op)。 程序例 : include include include include define ARROW_SIZE 10 void draw_arrow(int x, int y)。 int main(void) { /* request autodetection */ int gdriver = DETECT, gmode, errorcode。 void *arrow。 int x, y, maxx。 unsigned int size。 /* initialize graphics and local variables */ initgraph(amp。 gdriver, amp。 gmode, )。 /* read result of initialization */ errorcode = graphresult()。 if (errorcode != grOk) /* an error occurred */ { printf(Graphics error: %s\n, grapherrormsg(errorcode))。 printf(Press any key to halt:)。 getch()。 exit(1)。 /* terminate with an error code */ } maxx = getmaxx()。 x = 0。 y = getmaxy() / 2。 /* draw the image to be grabbed */ draw_arrow(x, y)。 /* calculate the size of the image */ size = imagesize(x, yARROW_SIZE, x+(4*ARROW_SIZE), y+ARROW_SIZE)。 /* allocate memory to hold the image */ arrow = malloc(size)。 /* grab the image */ getimage(x, yARROW_SIZE, x+(4*ARROW_SIZE), y+ARROW_SIZE, arrow)。 /* repeat until a key is pressed */ while (!kbhit()) { /* erase old image */ putimage(x, yARROW_SIZE, arrow, XOR_PUT)。 x += ARROW_SIZE。 if (x = maxx) x = 0。 /* plot new image */ putimage(x, yARROW_SIZE, arrow, XOR_PUT)。 } /* clean up */ free(arrow)。 closegraph()。 return 0。 } void draw_arrow(int x, int y) { /* draw an arrow on the screen */ moveto(x, y)。 linerel(4*ARROW_SIZE, 0)。 linerel(2*ARROW_SIZE, 1*ARROW_SIZE)。 linerel(0, 2*ARROW_SIZE)。 linerel(2*ARROW_SIZE, 1*ARROW_SIZE)。 } 函数名 : putpixel 功 能 : 在指定位置画一像素 用 法 : void far putpixel (int x, int y, int pixelcolor)。 程序例 : include include include include include define PIXEL_COUNT 1000 define DELAY_TIME 100 /* in milliseconds */ int main(void) { /* request autodetection */ int gdriver = DETECT, gmode, errorcode。 int i, x, y, color, maxx, maxy, maxcolor, seed。 /* initialize graphics and local variables */ initgraph(amp。 gdriver, amp。 gmode, )。 /* read result of initialization */ errorcode = graphresult()。 if (errorcode != grOk) /* an error occurred */ { printf(Graphics error: %s\n, grapherrormsg(errorcode))。 printf(Press any key to halt:)。 getch()。 exit(1)。 /* terminate with an error code */ } maxx = getmaxx() + 1。 maxy = getmaxy() + 1。 maxcolor = getmaxcolor() + 1。 while (!kbhit()) { /* seed the random number generator */ seed = random(32767)。 srand(seed)。 for (i=0。 iPIXEL_COUNT。 i++) { x = random(maxx)。 y = random(maxy)。 color = random(maxcolor)。 putpixel(x, y, color)。 } delay(DELAY_TIME)。 srand(seed)。 for (i=0。 iPIXEL_COUNT。 i++) { x = random(maxx)。 y = random(maxy)。 color = random(maxcolor)。 if (color == getpixel(x, y)) putpixel(x, y, 0)。 } } /* clean up */ getch()。 closegraph()。 return 0。 } 函数名 : puts 功 能 : 送一字符串到流中 用 法 : int puts(char *string)。 程序例 : include int main(void) { char string[] = This is an example output string\n。 puts(string)。 return 0。 } 函数名 : puttext 功 能 : 将文本从存储区拷贝到屏幕 用 法 : int puttext(int left, int top, int right, int bottom, void *source)。 程序例 : include int main(void) { char buffer[512]。 /* put some text to the console */ clrscr()。 gotoxy(20, 12)。 cprintf(This is a test. Press any key to continue ...)。 getch()。 /* grab screen contents */ gettext(20, 12, 36, 21,buffer)。 clrscr()。 /* put selected characters back to the screen */ gotoxy(20, 12)。 puttext(20, 12, 36, 21, buffer)。 getch()。 return 0。 } 函数名 : putw 功 能 : 把一字符或字送到流中 用 法 : int putw(int w, FILE *stream)。 程序例 : include include define FNAME test.$$$ int。c语言库函数(编辑修改稿)
相关推荐
内部故障造成的。 如气体继电器内有气体,则应记录气量,观察气体的颜色及试验是否可燃,并取气样及油样做色谱分析,可根据有关规程和导则判断变压器的故障性质。 若气体继电器内的气体为无色、无臭且不可燃,色谱分析判断为空气,则变压器可继续运行,并及时消除进气缺陷。 若气体是可燃的或油中溶解气体分析结果异常,应综合判断确定变压器是否停运。 瓦斯保护动作跳闸时,在查明原因消除故障前不得将变压器投入运行。
量船底的发射换能器垂直向水下发射一定频率的声波脉冲,以声速 C 在水中传播到水底后产生回波,回波被接收换能器所接收,发射声波与接收回波的时间 t,则换能器表面至水底的距离(水深)为 H=1/2 ct 测深仪在使用前,应进行动态、静态比对试验,有多套测深仪时应进行交叉比对,只有一套仪器时,可以用测深杆进行比对。 回声测深仪的安装,一般安装在测量船的中舷处,因为中舷处在航行中吃水线的变化最小。
567”。 for( i=0,j=strlen(str)1。 ④。 ⑤ ) { ch=str[i]。 ⑥。 str[j]=ch。 } printf(“ %s\n” , str )。 } 用直接选择排序法对数组中的 10 个整数按从小到大排序。 main() { void selectsort(int b[ ],int n)。 int a[ ]={36,12,45,79,34,5,26,51,18
=20。 n++) { t*=n。 s+=t。 } printf(“ 1+2!+3!...+20!=%e\n“ ,s)。 } ============================================================== 【程序 26】 题目:利用递归方法求 5!。 :递归公式: fn=fn_1*4! : include “ “ main() { int i。
a= b+(((c/d)/function— call())* 5) 这样,就能确保表达式被正确求值,而且编译程序不会为了优化代码而重新安排运算符的优先级了。 1. 13 ++var 和 var++有什么区别 ? “++” 运算符被称为自增运算符。 如果 “++” 运算符出现在变量的前面 (++var),那么在表达式使用变量之前,变量的值将增加 1。 如果 “++” 运算符出现在变量之后
六) 第 6 章 Inter 网络基础 2 课程设计学时 合 计 20学时 五、 考核方式 根据本课程的特点,应注意基础理论和操作能力并重。 考核方式为:平时成绩和单元作业占 20%,上机操作能力考核占 40%,期末理论考试占 40%。 六、 教材与参考教材 选用教材: 《计算机应用基础》 杨明广 主编 电子科技大学出版社 《计算机应用基础》 黄迪明 主编 电子科技大学出版社 99 年版