Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
510 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...