Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
506 views
in Technique[技术] by (71.8m points)

c++ - How to print M character with heart symbols in C language?

I am new to programming. I want to print SUM with hearts, I got SU but I am unable to print M. Could you please help me with code ? here is my SU code.

#include<stdio.h>
#include<conio.h>
void main()
{
    char i=3;
    int j,k;

    for(j=0; j<=8; j++)     //s
        printf("%c",i);

    printf("
%c
%c
",i,i);

    for(j=0; j<=8; j++)
        printf("%c",i);

    printf("
");

    for(j=0;j<=1; j++)
    {    
        for(k=0; k<=7; k++)
        {
            printf(" ");
        }

        printf("%c
",i);
    }

    for(j=0; j<=8; j++)
        printf("%c",i);

    printf("

");

    for(j=0; j<=7; j++)
    {      //u
        printf("%c",i);

        for(k=0; k<=1; k++)
            printf("   ");

        printf("%c
",i);}

        for(j=0; j<=6; j++)
            printf("%c",i);

        printf("

");
    }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I would set it up like this

char letter_s[7] = {
    0b11111111,
    0b10000000,
    0b10000000,
    0b11111111,
    0b00000001,
    0b00000001,
    0b11111111 };

char letter_m[7] = {
    0b10000010,
    0b11000110,
    0b10101010,
    0b10010010,
    0b10000010,
    0b10000010,
    0b10000010 };

and then write code to print '3' for every 1 bit in a character array.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...