xyprint和printf的区别与outtextxy有区别么

温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
爱 过  痛过   但没恨过!!!
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(107)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_095070',
blogTitle:'数控机床操作教程3',
blogAbstract:'第四章&&&&&& 轮廓控制原理实验
插补模块是整个数控系统中一个极其重要的功能模块之一,插补算法的选择将直接影响到系统的精度、速度和加工能力范围。为此,本章将对各种插补原理进行剖析和实验。
  插补算法很多,可以归纳为两大类:脉冲增量插补算法和数据采样插补算法。
  脉冲增量插补算法比较简单,比较容易用硬件实现,所以,硬件数控系统较多采用该法,但随着计算机速度的大大提高,也可用软件模拟硬件来实现这类插补。这类',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:9,
publishTime:0,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'爱 过  痛过   但没恨过!!!',
hmcon:'0',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}代码_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
&&酒店管理代码
阅读已结束,下载本文需要
想免费下载更多文档?
定制HR最喜欢的简历
下载文档到电脑,同时保存到云知识,更方便管理
还剩45页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢C语言编程,printf 能在图形模式下输出数字吗?不能的话,应用什么函数来输出?通过输出变量来输出数字。。_百度知道
C语言编程,printf 能在图形模式下输出数字吗?不能的话,应用什么函数来输出?通过输出变量来输出数字。。
我有更好的答案
  如果是指C语言的graphics扩展,输出数字只有一种方法,然后用outtext或者outtextxy输出文本:先把数字转换为文本。任何图形方式都是不可能直接输出数值的,但是任何图形方式都有各自输出文本的方法,这些方法通常完全不同printf只在文本模式下有效。  不知道你说的图形模式是指什么
采纳率:54%
printf是在控制台模式下输出的图形模式下你需要操作dc,使用dc中的函数进行绘制。
为您推荐:
其他类似问题
抵押贷款的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。求c语言英文打字练习程序_百度知道
求c语言英文打字练习程序
功能要求如下:
1)程序开始后首先是练习模式选择界面,有三种练习模式可以选择,分别是单词练习和文本练习。
2)单词练习:要求在屏幕上绘制三个窗口,一个用来显示用户输入,一个用来显示练习的单词,另一个用来显示统计数据。每次在屏幕上显示一个单词,...
我有更好的答案
比较简单:/*练习训练游戏*/#include &stdio.h&#include &graphics.h&#include &conio.h&#include &bios.h&#include &dos.h&#include &time.h&#define MAXCHAR 100#define ESC
/* 退出程序键,调用quitgame()函数*/#define F1 0x3b00 /* 查看帮助信息,调用Help()函数 */#define F2 0x3c00 /* 查看关于...信息,调用About()函数 */#define F3 0x3d00 /* 以下功能键暂时保留,如果增加功能可使用 */#define F4 0x3e00 #define F5 0x3f00 #define F6 0x4000#define F7 0x4100#define F8 0x4200#define F9 0x4300#define F10 0x4400#define KEY1
0x0231#define KEY2
0x0332#define KEY3
0x0433#define KEY4
0x0534#define KEY01
0x4f31#define KEY02
0x5032#define KEY03
0x5133#define KEY04
0x4b34char string[MAXCHAR+1];int LittleWin(int WinType/*=1, =2, H=3, A =4,*/);/*when WinType=1, return 0, quit, return 1, not quit*/void quitgame();void Welcome();void drawframe();void Frame();void GetCharacter();void Typing();int LittleWin(int WinType/*=1, =2, H=3, A =4,*/)/*when WinType=1, return 0, quit, return 1, not quit*/{
window(18,6,62,20); textbackground(LIGHTGRAY); textcolor(BLACK); clrscr(); gotoxy(1,1); cprintf(&%c&,201); for(i=0;i&43;i++)
cprintf(&%c&,205); cprintf(&%c&,187); for(i=0;i&13;i++) {
gotoxy(1,i+2);
cprintf(&%c&,186);
gotoxy(45,i+2);
cprintf(&%c&,186); } gotoxy(1,14); cprintf(&%c&,200); for(i=0;i&43;i++)
cprintf(&%c&,205); cprintf(&%c&,188); gotoxy(20,1); switch(WinType) {
cprintf(& Exit &);
textcolor(LIGHTRED);
gotoxy(18,3);
cprintf(&Warning!&);
textcolor(LIGHTBLUE);
gotoxy(5,5);
cprintf(&This operation will exit the program!&);
gotoxy(10,7);
cprintf(&Do you really want to quit?&);
textcolor(LIGHTGREEN);
gotoxy(18,9);
cprintf(&OK? [Y/N]&);
/*window(18,20,62,20);
textbackground(LIGHTBLUE);
textcolor(YELLOW);
clrscr();*/
window(19,18,61,18);
textbackground(LIGHTBLUE);
textcolor(WHITE);
gotoxy(5,1);
cprintf(&Press Y to quit, press N to return.&);
ch=getch();
if(ch=='Y'||ch=='y')
else if(ch=='N'||ch=='n')
cprintf(& Help &);
cprintf(& About &);
cprintf(& Info &);
}}void quitgame(){ if(LittleWin(1)) {
} window(1,1,80,25); textbackground(BLACK); textcolor(LIGHTGRAY); clrscr(); exit(0);}void Welcome(){ int driver=VGA,mode=VGAHI;
/*定义变量*/ int x1=20,y1=20,r=10,num,i; int x2=20,y2=450; int color1=10,color2=10;
/*在此设置颜色,一改全改*/ static char ch1[28][2]={&W&,&e&,&l&,&c&,&o&,&m&,&e&,& &,&t&,&o&,& &,&t&,&h&,&e&,& &,&T&,&y&,&p&,&i&,&n&,&g&,& &,&W&,&o&,&r&,&l&,&d&,&!&}; initgraph(&driver,&mode,&C:\\tc &);
/*初始化图形模式*/ setbkcolor(LIGHTBLUE); setcolor(color1);
/*步骤一、设置当前颜色用于绘图*/ for(num=0;num&30;num++) {
circle(x1,y1,r);
/*步骤二、使用当前颜色绘制一个闭合图形*/
setfillstyle(num%12,color1);
/*步骤三、设置填充方式*/
floodfill(x1,y1,color1);
/*步骤四、对闭合图形进行填充*/
sound(300); /*输出声音*/
delay(3000);
nosound(); } setcolor(color2); for(num=0;num&30;num++) {
circle(x2,y2,r);
setfillstyle(num%12,color2);
floodfill(x2,y2,color2);
sound(300); /*输出声音*/
delay(3000);
nosound(); } settextstyle(0,0,2); setcolor(LIGHTRED); sound(300); /*输出声音*/ delay(3000); nosound(); outtextxy(180,90,&^o^ Hello! ^o^&); sound(300); /*输出声音*/ delay(3000); nosound(); setcolor(YELLOW); gotoxy(50,150); for(i=0;i&28;i++) {
outtextxy(50+i*16,150,ch1[i]);
sound(300); /*输出声音*/
delay(3000);
nosound(); } /*outtextxy(50,150,&Welcome to the Typing World!&);*/ setcolor(WHITE); outtextxy(50,200,&This is a little&); sound(300); /*输出声音*/ delay(6000); nosound(); outtextxy(100,250,&Typing Training&); sound(300); /*输出声音*/ delay(6000); nosound(); outtextxy(150,300,&Software ... ^_^&); sound(300); /*输出声音*/ delay(6000); nosound(); setcolor(LIGHTMAGENTA); outtextxy(100,350,&Ver. &); sound(300); /*输出声音*/ delay(6000); nosound(); setcolor(LIGHTGREEN); outtextxy(100,400,&Press any key to start...&); sound(300); /*输出声音*/ delay(6000); nosound(); getch(); closegraph();
/*关闭图形*/}void drawframe(){
window(1,1,80,1); textbackground(LIGHTGRAY); textcolor(BLACK); clrscr(); gotoxy(7,1); cprintf(&File
Help&); textcolor(RED); gotoxy(7,1); cprintf(&F&); gotoxy(14,1); cprintf(&E&); gotoxy(21,1); cprintf(&R&); gotoxy(27,1); cprintf(&C&); gotoxy(37,1); cprintf(&P&); gotoxy(47,1); cprintf(&O&); gotoxy(57,1); cprintf(&D&); gotoxy(65,1); cprintf(&H&); window(1,25,80,25); textbackground(LIGHTGRAY); textcolor(BLACK); clrscr(); gotoxy(7,1); printf(&F1-Help
F4-Restart
Ctrl+F9-Run
ESC-Quit&); textcolor(RED); gotoxy(7,1); cprintf(&F1&); gotoxy(17,1); cprintf(&F2&); gotoxy(28,1); cprintf(&F3&); gotoxy(37,1); cprintf(&F4&); gotoxy(50,1); cprintf(&Ctrl+F9&); gotoxy(64,1); cprintf(&ESC&); window(1,2,80,24); textbackground(LIGHTBLUE); textcolor(LIGHTGRAY); clrscr(); gotoxy(1,2); cprintf(&%c&,213); for(i=0;i&78;i++)
cprintf(&%c&,205); cprintf(&%c&,184); for(i=0;i&21;i++) {
gotoxy(1,i+3);
cprintf(&%c&,179);
gotoxy(80,i+3);
cprintf(&%c&,179); } gotoxy(1,22); cprintf(&%c&,192); for(i=0;i&78;i++)
cprintf(&%c&,196); cprintf(&%c&,217); textcolor(WHITE); gotoxy(37,1); cprintf(& Type &);}void Frame()
/*设置菜单函数*/{ drawframe(); window(2,3,79,22); textbackground(LIGHTBLUE); textcolor(YELLOW); clrscr(); gotoxy(25,2);
cprintf(&The Typing World Menu\n&);
gotoxy(12,4); cprintf(&1:Practice Only ENGLISH Characters.&);
gotoxy(12,6); cprintf(&2:Practice Other Charcters.&);
gotoxy(12,8); cprintf(&3:Practice All Charcters.&);
gotoxy(12,10); cprintf(&4:Quit at once!&); GetCharacter();}void GetCharacter(void)
/*设置得到字符函数*/{ void Typing();
/*声明typing()函数*/ FILE * int i,t,
t=abs(time(0))%700;
/*获取随机数来指定下面指针的位*/ gotoxy(12,12); cprintf(&Please input your choice: &); while(1) {
gotoxy(38,12);
choice=bioskey(0);
if(choice==ESC||choice==KEY4||choice==KEY04)
quitgame();
else if(choice==KEY1||choice==KEY01)
in=fopen(&english.dat&,&r&);
else if(choice==KEY2||choice==KEY02)
in=fopen(&others.dat&,&r&);
else if(choice==KEY3||choice==KEY03)
in=fopen(&typeall.dat&,&r&);
} } clrscr();
/*清屏*/ fseek(in,t*1l,0); fgets(string,MAXCHAR+1,in); textcolor(WHITE); gotoxy(1,2); cprintf(&******************************************************************************&); textcolor(YELLOW); for(i=0;i&MAXCHAR;i++) cprintf(&%c&,string[i]); gotoxy(1,5); textcolor(WHITE); cprintf(&******************************************************************************&); fclose(in); gotoxy(1,6); cprintf(&Let's begin typing,OK?[Y/N]&); while(1) {
gotoxy(28,6);
ch=getch();
if(ch=='n'||ch=='N')
/*判断是否练习打字*/
quitgame();
else if(ch=='y'||ch=='Y')
} }}void Typing(void)
/*设置打字(包括计算其他结果)函数*/{ int i,j,Right_char=0,Wrong_char=0,Sum_char=0; float Speed,Timeused,Right_ char absorb_char,ch_1,ch_2,ch_3; time_t star,
/*定义time变量,获取系统时间并显示在屏幕上*/ time(&star); textcolor(WHITE); gotoxy(1,6); cprintf(&time begin:%s&,ctime(&star)); gotoxy(1,7); i=0; textcolor(YELLOW); absorb_char=getch();
/*接受键盘输入的字符并在下面的while语句判断正错和计算结果*/ while(i&MAXCHAR) {
if(absorb_char=='\n')
cprintf(&%c&,absorb_char);
if(absorb_char==string[i])
Right_char++;
Sum_char++;
Wrong_char++;
Sum_char++;
absorb_char=getch(); } time(&stop); Timeused=difftime(stop,star);
/*利用difftime()函数输出所用时间*/ Right_rate=(float)Right_char/(float)Sum_char*100; Speed=(Sum_char/Timeused)*60; textcolor(WHITE); gotoxy(1,11); cprintf(&time end:%s&,ctime(&stop));
/*下面显示分数*/ textcolor(LIGHTGREEN); gotoxy(1,12); cprintf(&********************Your Score!*************************&); gotoxy(7,13); textcolor(WHITE); cprintf(&
1: TOTAL TIME USED:%.3f&,Timeused); gotoxy(7,14); cprintf(&
2: YOU HAVE TYPED:%d&,Sum_char); gotoxy(7,15); cprintf(&
3: Typing Right_Characters are:%d&,Right_char); gotoxy(7,16); cprintf(&
4: Typing Wrong_Characters are:%d\n&,Wrong_char); gotoxy(7,17); cprintf(&
5: YOUR TYPING SPEED IS :%.2f\\min\n&,Speed); gotoxy(7,18); cprintf(&
6: YOUR TYPING RIGHT_RATE IS :%.2f%%\n&,Right_rate); textcolor(LIGHTGREEN); gotoxy(1,19); cprintf(&********************Your Score!*************************&); gotoxy(1,20); textcolor(WHITE);
if(Speed&=50||Right_rate&=80)
/*询问用户是否重来一遍*/ {
cprintf(&Not Very Good!
Try it Again,OK?[Y/N]&);
gotoxy(39,20);
ch_2=getch();
if(ch_2=='n'||ch_2=='N')
quitgame();
else if(ch_2=='y'||ch_2=='Y')
cprintf(&Well Done!!
One More Time?[Y/N]&);
/*询问用户是否重来一遍*/
gotoxy(35,20);
ch_3=getch();
if(ch_3=='n'||ch_3=='N')
quitgame();
else if(ch_3=='y'||ch_3=='Y')
}}main(void)
/*主函数包含两个要调用的函数*/{ /*Welcome();*/ Frame();}/*注:cprintf与printf的区别如下: 1.cprintf函数用于向当前窗口输出数据,比如你用window函数定义一个窗口
window(20,10,60,20),那么当你调用cprintf函数时,cprintf的输出就是相对于20,10,
60,20这个窗口,当输出的字符串长度大于当前窗口长度时,会在当前窗口自动换行。
默认方式下,当前窗口为整个屏幕,即:0,0,79,25 2.cprintf函数可以配合setcolor,setbkcolor等函数使用,而调用printf函数时会忽略这些
函数执行的结果。
比如执行:setcolor(RED);
cprintf( &Hello
printf( &Hello &);
将会在屏幕上显示红色字符串:Hello
和白色字符串(因为setcolor函数对printf函数比起作用:Hello 在原来的C语言中,cprintf中的c代表console,就是控制台.(conio.h中的con也是这个意思)到了windows也继承了这个渊源. 按照设计者本来的意图,printf是标准输出,就是指可以完全不知道你输出的对象,只是以标准的文本流方式输出.cprintf是与终端相关的,要用到一些系统平台,硬件设备相关的特性,所以可以有颜色等很多东西可供选择,同时也削弱了移植性所以cprintf是非标准的. */
分太少,飘
弄2分走先,至少也要弄个200以上
貌似这个用VB 会简单点
有点麻烦……
其他1条回答
为您推荐:
其他类似问题
您可能关注的内容
英文打字的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。您所在位置: &
&nbsp&&nbsp&nbsp&&nbsp
《C语言项目实践指导书图形程序设计.docx 46页
本文档一共被下载:
次 ,您可全文免费在线阅读后下载本文档。
下载提示
1.本站不保证该用户上传的文档完整性,不预览、不比对内容而直接下载产生的反悔问题本站不予受理。
2.该文档所得收入(下载+内容+预览三)归上传者、原创者。
3.登录后可充值,立即自动返金币,充值渠道很便利
《C语言项目实践指导书图形程序设计
你可能关注的文档:
··········
··········
大连东软信息学院电子工程系2014级 本科C语言项目实践指导书(图形程序设计)2015年8月大连东软信息学院Dalian Neusoft University of Information目 录0 C语言图形程序开发环境(4学时)- 2 -1 图形模式的初始化- 2 -2 独立图形运行程序的建立- 6 -3 屏幕颜色的设置和清屏函数(4学时)- 7 -4 基本图形函数(4学时)- 10 -5 封闭图形的填充(4学时)- 16 -6 有关图形窗口和图形屏幕操作函数(4学时)- 21 -7 图形模式下的文本输出(4学时)- 24 -8 使用gotoxy & window函数(2学时)- 30 -9 按键(4学时)- 32 -10 TC向VC控制台程序移植(2学时)- 34 -11 菜单制作(6学时)- 40 -12 综合程序设计(12学时)- 40 -补充1 声音- 41 -补充2 鼠标- 41 -参考文献- 44 -C语言项目实践(图形程序设计)分为14个部分(节),主要实践内容包括图形模式的初始化、基本图形功能、图形窗口以及图形模式下的文本输出等图形函数的使用,以及按键处理、菜单制作、TC向VC控制台程序移植、声音和鼠标的添加等。学生通过编辑、编译、调试、运行项目报告中的原代码和回答相关的问题,掌握C语言图形应用程序中常用函数的作用与使用方法,并综合运用《C语言程序设计》和《数据结构》课程所学知识,设计、实现具有创新功能的程序。成果物是一个综合性较好的图形应用程序和项目报告。项目报告中除了第2节,其它各节都有程序练习和问题,由学生按要求填写完成。0 C语言图形程序开发环境(4学时)C语言项目实践(图形程序设计)的开发环境是Turbo C。Turbo C集成开发环境是由Borland公司开发的一套 C 语言开发工具,它集成了程序编辑、调试、链接等多种功能。关于Turbo C 2.0的安装与使用参考“Turbo C 2.0集成开发环境.pdf”文档。 Turbo C提供了非常丰富的图形函数,所有图形函数的原型均在graphics. h中。使用图形函数时要确保有显示器图形驱动程序*BGI,同时将集成开发环境Options/Linker中的Graphics lib选为on,只有这样才能保证正确使用图形函数。如果想用C语言在VC++编译器中编辑图形界面程序,需安装VC++和EasyX。 EasyX是基于C++开发的,与TC的图形库一定程度上保持一致。关于VC++和EasyX 图形库的安装将在第10节“TC向VC控制台程序移植”部分进行说明。1 图形模式的初始化不同的显示器适配器有不同的图形分辨率。即是同一显示器适配器,在不同模式下也有不同分辨率。因此,在屏幕作图之前,必须根据显示器适配器种类将显示器设置成为某种图形模式,在未设置图形模式之前,微机系统默认屏幕为文本模式(80列, 25行字符模式),此时所有图形函数均不能工作。设置屏幕为图形模式,可用下列图形初始化函数:void far initgraph(int far *gdriver, int far *gmode, char *path);其中gdriver和gmode分别表示图形驱动器和模式,path是指图形驱动程序所在的目录路径,如:&C:\\TC20\\BGI&或&c:\\tc&等。有关图形驱动器、图形模式的符号常数及对应的分辨率见表1。图形驱动程序由Turbo C出版商提供,?文件扩展名为.BGI。根据不同的图形适配器有不同的图形驱动程序。例如对于EGA、VGA图形适配器就调用驱动程序EGAVGA.BGI。表1.1 图形驱动器、模式的符号常数及数值━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━图形驱动器(gdriver)?图形模式(gmode)───────────────?? ─────────────?色调?分辨率符号常数?数值?符号常数数值━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━CGA?1CGAC00CCGAC11CCGAC22CCGAC33CCGAHI42色640*200───────────────────────────────────────────────────MCGA 2MCGAC00CMCGAC11CMCGAC22CMCGAC33CMCGAMED42色640*200MCGAHI52色640*480───────────────────────────────────────────────────EGA3EGALO016色64
正在加载中,请稍后...}

我要回帖

更多关于 cout和printf的区别 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信