sprintf()的用法?
#include<stdio.h>#include<graphics.h>
main()
{
int gdriver=DETECT,gmode;
char c='a',s[20];
inigraph(&gdriver,&gmode,"c:\\turboc2");
setbkcolor(7);
setcolor(4);
settextstyle(1,0,2);
sprintf(s,"%c",c); /*没有输出*/
getch();
closegraph();
}
----------------解决方案--------------------------------------------------------
我知道了
sprintf():
后面加一句输出语句
----------------解决方案--------------------------------------------------------
是这样啊!
SPRINTF ----------------解决方案--------------------------------------------------------
see this page:
http://www.cnblogs.com/wqlblogger/archive/2007/01/09/615525
sprintf详解
----------------解决方案--------------------------------------------------------
是这样吗?
#include<stdio.h>#include<graphics.h>
main()
{
int gdriver=DETECT,gmode;
char c='a',s[20];
initgraph(&gdriver,&gmode,"c:\TC200");
setbkcolor(5);
setcolor(20);
settextstyle(1,0,2);
sprintf(s,"%c",c); /*没有输出*/
printf("%c",s[0]);
getch();
closegraph();
}
----------------解决方案--------------------------------------------------------