永发信息网

怎样用C语言程序写出一个字?

答案:6  悬赏:0  手机版
解决时间 2021-02-12 04:00
怎么用C编写程序写出“鉴”字?

就是C语言程序运行之后,屏幕上显示出“鉴”这个字,不要通过连接图片显示出来的那种,要运行之后就能显示出来的,字体最好是彩色渐变色,实在不行蓝色也行

当然,要是运行之后,能显示出一笔一笔写出来(就像用笔一笔一笔写出来那样)的效果那就更好了

恳请高手们帮帮忙,在下万分感谢!!
要Vista系统下,用VC或TC能运行成功的
最佳答案
本题一个完美的程序如下,程序已在tc2.0和win-tc下运行通过。
说明:如果程序不能运行,请将initgraph(&gdriver,&gmode,"")函数中的""更改为你的TC安装目录。比如你的TC安装目录为D盘的Tools子目录下的TC目录,那么上述语句改为:initgraph(&gdriver,&gmode,"D:\\Tools\\TC");
同时保证在D:\\Tools\\TC目录里有文件EGAVGA.BGI,如果没有从TC安装目录下复制一个过来。万一不行,将本程序复制到你的TC安装目录下再运行。
如还有疑问,给我消息。
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <dos.h>
#include <graphics.h>

int main()
{int i,j;
int gdriver=DETECT,gmode;
initgraph(&gdriver,gmode,"");
srand((unsigned)time(NULL));
setbkcolor(0);
setlinestyle(0,0,3);
while(!kbhit())
{setcolor(rand()%16);
line(200,200,200,225);
delay(100000);
line(225,175,225,225);
delay(100000);
line(275,175,250,225);
delay(100000);
line(263,200,300,200);
delay(100000);
line(263,200,275,225);
delay(100000);
line(250,225,200,275);
delay(100000);
line(250,225,300,275);
delay(100000);
line(225,250,275,250);
delay(100000);
line(225,275,275,275);
delay(100000);
line(250,250,250,325);
delay(100000);
line(230,280,250,325);
delay(100000);
line(270,280,250,325);
delay(100000);
line(200,325,300,325);
delay(100000);
for(j=0;j<10;j++)
delay(300000);
cleardevice();
}
getch();
closegraph();
return 0;
}
全部回答
可以找到这个字的ASCII码嘛!然后输出这个ASCII的值!
汉字的显示,就是显示点阵数据。 汉字的编码,就是已经存储在计算机里的点阵数据的编号。 这个题,你可以在屏幕逐个描点,以达到想要的效果。 描点需要图形库的支持,比如dos下,就有graphic.h 如果你在dos下编程,就用它吧 windows不支持graphic.h图形库 因为,windows支持窗口模式的编程
Win-TC下面有字模工具还有范例,你可以去看一下 #include "Conio.h" #include "graphics.h" #define closegr closegraph void initgr(void) { int gd = DETECT, gm = 0; registerbgidriver(EGAVGA_driver); initgraph(&gd, &gm, ""); } void drawmat(char *mat,int matsize,int x,int y,int color) { int i, j, k, n; n = (matsize - 1) / 8 + 1; for(j = 0; j < matsize; j++) for(i = 0; i < n; i++) for(k = 0;k < 8; k++) if(mat[j * n + i] & (0x80 >> k)) putpixel(x + i * 8 + k, y + j, color); } char jian64S[]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x00,0x00,0x02,0x00,0x03,0xC0,0x00,0x00, 0x00,0x00,0x03,0x80,0x03,0xC0,0x00,0x00, 0x00,0x00,0x03,0x80,0x03,0x80,0x00,0x00, 0x00,0x18,0x03,0x00,0x07,0x00,0x00,0x00, 0x00,0x1E,0x03,0x00,0x06,0x00,0x00,0x00, 0x00,0x1C,0x03,0x00,0x06,0x00,0x02,0x00, 0x00,0x18,0x03,0x00,0x0C,0x00,0x07,0x00, 0x00,0x18,0x03,0x00,0x08,0x00,0x0F,0x80, 0x00,0x18,0x03,0x00,0x1F,0xFF,0xFF,0xC0, 0x00,0x18,0x03,0x00,0x10,0x00,0x00,0x00, 0x00,0x18,0x03,0x00,0x20,0x00,0x00,0x00, 0x00,0x18,0x03,0x00,0x20,0x10,0x00,0x00, 0x00,0x18,0x03,0x00,0x40,0x08,0x00,0x00, 0x00,0x18,0x03,0x00,0x00,0x06,0x00,0x00, 0x00,0x18,0x03,0x00,0x00,0x03,0x00,0x00, 0x00,0x18,0x03,0x00,0x00,0x03,0x80,0x00, 0x00,0x18,0x03,0x01,0x00,0x01,0xC0,0x00, 0x00,0x18,0x03,0x01,0xC0,0x01,0xE0,0x00, 0x00,0x18,0x03,0x03,0xE0,0x00,0xE0,0x00, 0x00,0x18,0x03,0x07,0x80,0x00,0xE0,0x00, 0x00,0x18,0x03,0x0F,0xC0,0x00,0xE0,0x00, 0x00,0x10,0x00,0x1E,0x20,0x00,0x40,0x00, 0x00,0x00,0x00,0x3C,0x10,0x00,0x00,0x00, 0x00,0x00,0x00,0x78,0x08,0x00,0x00,0x00, 0x00,0x00,0x00,0xF0,0x04,0x00,0x00,0x00, 0x00,0x00,0x01,0xC0,0x03,0x00,0x00,0x00, 0x00,0x00,0x03,0x80,0x01,0x80,0x00,0x00, 0x00,0x00,0x07,0x00,0x00,0xE0,0x00,0x00, 0x00,0x00,0x1C,0x00,0x00,0x78,0x00,0x00, 0x00,0x00,0x38,0x00,0x00,0x3E,0x00,0x00, 0x00,0x00,0xE0,0x00,0x01,0x0F,0xC0,0x00, 0x00,0x01,0xC0,0x00,0x03,0x87,0xF8,0x00, 0x00,0x07,0x07,0xFF,0xFF,0xC1,0xFF,0xF0, 0x00,0x1C,0x02,0x01,0x80,0x00,0x7F,0xF0, 0x00,0x70,0x00,0x01,0x80,0x00,0x1F,0x80, 0x01,0xC0,0x00,0x01,0x80,0x00,0x07,0x80, 0x06,0x00,0x00,0x01,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x80,0x00,0x80,0x00, 0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x00, 0x00,0x00,0x00,0x01,0x80,0x03,0xC0,0x00, 0x00,0x03,0xFF,0xFF,0xFF,0xFF,0xE0,0x00, 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x80,0x18,0x00,0x00, 0x00,0x00,0x10,0x01,0x80,0x1E,0x00,0x00, 0x00,0x00,0x08,0x01,0x80,0x1C,0x00,0x00, 0x00,0x00,0x0C,0x01,0x80,0x38,0x00,0x00, 0x00,0x00,0x0E,0x01,0x80,0x20,0x00,0x00, 0x00,0x00,0x06,0x01,0x80,0x40,0x00,0x00, 0x00,0x00,0x06,0x01,0x80,0x00,0x00,0x00, 0x00,0x00,0x04,0x01,0x80,0x80,0x02,0x00, 0x00,0x00,0x00,0x01,0x80,0x00,0x07,0x00, 0x00,0x00,0x00,0x01,0x80,0x00,0x0F,0x80, 0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; int main(void) { int i, j; initgr(); drawmat(jian64S, 64, 100, 125, BLUE); getch(); closegr(); return 0; }
以下代码实现字符从右到左循环滚动. c语言控制台程序 #include  #include  #include  int main() { char str[100] = "hello world! good bye!"; int i,j; for(i=0;i
  • 5楼网友:独钓一江月
  • 2021-02-12 00:18
……几个途径啦 其一,其实字也是图片的一种,平时看到的字都是通过字体库显示出来的 所以要达到效果应该需要看有没相关库函数可以调用字体库的 其二,完全自己搞定就好啦,显示个字也不是很难啦说到底就是点阵显示而已嘛。可以自己看看怎么显示点阵,或者最简单去网上搜下鉴这个字的点阵是怎么排的。然后用符号把鉴这个字的点阵输出就可以了 如果要一笔一划写出来,再用时间函数就好啦 至于彩色,不会啦~
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯