所有栏目

putch

作者:爱百科

在当前光标处向屏幕输出字符ch,然后光标自动右移一个字符位置。

putch详细介绍

在当前光标处向屏幕输出字符ch,然后光标自动右移一个字符位置。

putch基本信息

函数名: putch

用 法: int putch(int ch),其中参数ch为要输出的字符。

返回值:如果输出成功,函数返回该字符;否则返回EOF。

说明:非ANSI C标准

putch程序例

1:(VC6.0中运行通过)

#include <stdio.h>

#include <conio.h>

int main(void)

{

char ch = 0;

printf("Input a string:");

while ((ch != 'r'))

{

ch = getch();

putch(ch);

}

return 0;

}

程序例2:(在TC下运行通过)

#include <stdio.h>

#include <conio.h>

int main()

{

int i;

char *ch="ok!welcome to here!";

textbackground(0);

clrscr();

for(i=1;i<8;i++)

{

window(10+i*5,5+i,30+i*5,15+i);

textbackground(i);

clrscr();

}

textcolor(RED);

clrscr();

cprintf(ch);

cputs(ch);

putch(3);

getch();

return 0;

}

热点导航
教育资讯 知道问答 公考资讯 司法考试 建筑知识 工作范文 大学排名 报考专业 学习方法 句子美文 秒知回答 作业解答 精选答案 知途问学