[C Language] Create a moving subtitle for confession

Table of Contents

What I want to share with you today is a very interesting subtitle change that can be used in many places, such as sending it to the person you like or your good brother. After we set the subtitles, they will continue to print on the screen. The content we want?! ! !

one.

Let me first explain the principle to you so that you can modify the content and printing method later. First, you need to know what we want to print. Here I use “I LOVE YOU” as an example:

We are now outputting I LOVE YOU large subtitles. The first issue to consider is the printing of the subtitles. What we want is large subtitles, but normal subtitles can only be in one line and are very small, which is not enough for what we express. Typing line by line will take a lot of your time, so I have prepared it for you in advance.

This is just a small premise for us to move subtitles. The following is the key point (if you want to change the content later, you can modify it here)

two.

Next, we will start to explain the algorithm and execution steps. If you want to achieve changes in the code, you must use a loop. We are constantly updating the contents of the array to make the output look like dynamic. At this time, you need to use an algorithm. Use characters in one array to continuously replace the contents of another group of array characters. This can be achieved by continuous input and dynamic changes.

To give an example:

Constantly replace the contents of the array to achieve the effect we want

three.

The principle is clearly explained, and the next step is the text content. Above we used 8 character arrays when performing replacement, so the following requires 8 array replacements. Under normal circumstances, everyone can choose according to their own output content.

At this point, our code is done. Now that the atmosphere is here, let me give you a big gift.

Just add the code to our code above and quote it. If you don’t understand, you can ask me privately.

Four.

The most important thing is how to let others see what we have done. Under normal circumstances, it is a headache for others to install C language software. Most people are novices, so our code will lose its effect. Everyone. If you are using “Visual Studio” software, follow my steps below:


What I want to share with you today is a very interesting subtitle change that can be used in many places, such as: sending it to those you like People or your good brothers, after we set the words, the content we want will continue to be printed on the screen?! ! !

一.

Let me explain the principle to you first, so that you can modify the content and printing method later. First, you need to know what we want to print. Here I use “I LOVE YOU” as an example:

We are now outputting I LOVE YOU large subtitles. The first issue to consider is the printing of the subtitles. We What I want is big subtitles, but normal subtitles can only be one line and are very small, which is not enough for the meaning we express. And typing line by line will take a lot of time for everyone. I have prepared it for you in advance

 char a[] = { " *************************************** *************************************************** ************************" };
    char a1[] = { "****************************************** *************************************************** **********************" };
    char b[] = { " ****#######*******###********#########**** ##************##**############****##************##**### ######**####****####**" };//1
    char a2[] = { "****************************************** *************************************************** **********************" };
    char c[] = { "******###**********###********##*****##**** *##************##***##******************##*****##***##* ****##***##******##***" };//2
    char a3[] = { "****************************************** *************************************************** **********************" };
    char d[] = { " ******###**********###********##*****##**** **##********##****############******##***##****##* ****##***##******##***" };// 3
    char a4[] = { "****************************************** *************************************************** **********************" };
    char e[] = { "******###**********###********##*****##**** ***##******##*****##******************###******##* ****##***##******##***" };// 4
    char a5[] = { "****************************************** *************************************************** **********************" };
    char f[] = { " ******###************###********##*****##**** ****##****##******############********###******##* ****##***##******##***" };// 5
    char a6[] = { "****************************************** *************************************************** **********************" };
    char l[] = { " ******###**********###********##*****##**** *****##**##*******##******************###******##* ****##***##******##***" };// 6
    char a7[] = { "****************************************** *************************************************** **********************" };
    char m[] = { "******###**********###********##*****##**** ******#**#********##******************###******##* ****##***##******##***" };// 7
    char a8[] = { "****************************************** *************************************************** **********************" };
    char n[] = { " ****#######*******#########**#########**** ******###**********############********###******### ######***##########***" };// 8
    

This is only a small premise for us to move subtitles, the following is the key point ( If you want to change the content later, you can modify it here)

Two.

Then let’s start to explain the algorithm and execution steps. If you want To implement code changes, you definitely need to use a loop. We are constantly updating the contents of the array to make the output look like dynamic. At this time, you need to use an algorithm to continuously replace the characters in one array with another group. The content of the array characters can be realized by continuous input and can be changed dynamically

Give an example:

int main()
{
    char a[]="abcdef";
    char b[]="******";
    int set=sizeof(a)/sizeof(char); //Calculate the number of arrays
    int left=0; //left coordinate
    int right=sz-2; //right coordinate
    while(left<=right)
    {
        b[left]=a[left];
        b[right]=b[right];
        printf("%s",b);
        left + + ;
        right--;
    }
    
   return 0;
}

Continuously replace the content of the array to achieve the effect we want

三.

The principle is clearly explained, and the next step is the text content. Above we used an 8-character array when performing the replacement, so the following requires the replacement of 8 arrays. Under normal circumstances, you can output the content according to your own Just make your choice

#include <stdio.h>
#include <windows.h>



int main()
{
    // **************** ****************
    char a[] = { " ****************************************** *************************************************** **********************" };
    char a1[] = { "****************************************** *************************************************** **********************" };
    char b[] = { " ****#######*******###********#########**** ##************##**############****##************##**### ######**####****####**" };//1
    char a2[] = { "****************************************** *************************************************** **********************" };
    char c[] = { "******###**********###********##*****##**** *##************##***##******************##*****##***##* ****##***##******##***" };//2
    char a3[] = { "****************************************** *************************************************** **********************" };
    char d[] = { " ******###**********###********##*****##**** **##********##****############******##***##****##* ****##***##******##***" };// 3
    char a4[] = { "****************************************** *************************************************** **********************" };
    char e[] = { "******###**********###********##*****##**** ***##******##*****##******************###******##* ****##***##******##***" };// 4
    char a5[] = { "****************************************** *************************************************** **********************" };
    char f[] = { " ******###************###********##*****##**** ****##****##******############********###******##* ****##***##******##***" };// 5
    char a6[] = { "****************************************** *************************************************** **********************" };
    char l[] = { " ******###**********###********##*****##**** *****##**##*******##******************###******##* ****##***##******##***" };// 6
    char a7[] = { "****************************************** *************************************************** **********************" };
    char m[] = { "******###**********###********##*****##**** ******#**#********##******************###******##* ****##***##******##***" };// 7
    char a8[] = { "****************************************** *************************************************** **********************" };
    char n[] = { " ****#######*******#########**#########**** ******###**********############********###******### ######***##########***" };// 8
    
    int sz = sizeof(a1) / sizeof(char);
    int left1 = 0;
    int right1 = sz - 2; //It contains \0, plus 2 because it is a coordinate
    int left2 = 0;
    int right2 = sz - 2;
    int left3 = 0;
    int right3 = sz - 2;
    int left4 = 0;
    int right4 = sz - 2;
    int left5 = 0;
    int right5 = sz - 2;
    int left6 = 0;
    int right6 = sz - 2;
    int left7 = 0;
    int right7 = sz - 2;
    int left8 = 0;
    int right8 = sz - 2;
    
    while (left1 <= right1)
    {
        a1[left1] = b[left1];
        a1[right1] = b[right1];
        printf("%s\\
", a1);
        Sleep(10);
        system("cls");
        left1 + + ;
        right1--;
    }

    while (left2 <= right2)
    {
        printf("%s\\
", a1);
        a2[left2] = c[left2];
        a2[right2] = c[right2];
        printf("%s", a2);
        Sleep(10);
        system("cls");
        left2 + + ;
        right2--;
    }
    while (left3 <= right3)
    {
        printf("%s\\
", a1);
        printf("%s\\
", a2);
        a3[left3] = d[left3];
        a3[right3] = d[right3];
        printf("%s", a3);
        Sleep(10);
        system("cls");
        left3 + + ;
        right3--;
    }
    while (left4 <= right4)
    {
        printf("%s\\
", a1);
        printf("%s\\
", a2);
        printf("%s\\
", a3);
        a4[left4] = e[left4];
        a4[right4] = e[right4];
        printf("%s", a4);
        Sleep(10);
        system("cls");
        left4 + + ;
        right4--;
    }
    while (left5 <= right5)
    {
        printf("%s\\
", a1);
        printf("%s\\
", a2);
        printf("%s\\
", a3);
        printf("%s\\
", a4);
        a5[left5] = f[left5];
        a5[right5] = f[right5];
        printf("%s", a5);
        Sleep(10);
        system("cls");
        left5 + + ;
        right5--;
    }
    while (left6 <= right6)
    {
        printf("%s\\
", a1);
        printf("%s\\
", a2);
        printf("%s\\
", a3);
        printf("%s\\
", a4);
        printf("%s\\
", a5);
        a6[left6] = l[left6];
        a6[right6] = l[right6];
        printf("%s", a6);
        Sleep(10);
        system("cls");
        left6 + + ;
        right6--;
    }
    while (left7 <= right7)
    {
        printf("%s\\
", a1);
        printf("%s\\
", a2);
        printf("%s\\
", a3);
        printf("%s\\
", a4);
        printf("%s\\
", a5);
        printf("%s\\
", a6);
        a7[left7] = m[left7];
        a7[right7] = m[right7];
        printf("%s", a7);
        Sleep(10);
        system("cls");
        left7 + + ;
        right7--;

    }
    while (left8 <= right8)
    {
        printf("%s\\
", a1);
        printf("%s\\
", a2);
        printf("%s\\
", a3);
        printf("%s\\
", a4);
        printf("%s\\
", a5);
        printf("%s\\
", a6);
        printf("%s\\
", a7);
        a8[left8] = n[left8];
        a8[right8] = n[right8];
        printf("%s", a8);
        Sleep(10);
        system("cls");
        left8 + + ;
        right8--;

    }
    


    printf("%s\\
", a);
    printf("%s\\
", a1);
    printf("%s\\
", a2);
    printf("%s\\
", a3);
    printf("%s\\
", a4);
    printf("%s\\
", a5);
    printf("%s\\
", a6);
    printf("%s\\
", a7);
    printf("%s\\
", a8);
    printf("%s\\
", a);

    
    //aixin();


    return 0;
}

    

At this point, our code is done. Since the atmosphere is here, , give you another big gift

void aixin()
{
    printf(" ******* ************\\
");
    printf(" ********** ************\\
");
    printf(" ************ ************\\
");
    printf(" ***************************\\
");
    printf("************************\\
");
    printf("************************\\
");
    printf("******************\\
");
    printf("****************\\
");
    printf(" **********\\
");
    printf(" ****\\
");
}

Just add the code to our code above and quote it. That’s it. If you don’t understand, you can message me privately to ask

四.

The most important thing is, how do we make it work? Others have seen that under normal circumstances, it is a headache for others to install C language software. Most people are novices, so our string of code loses its effect. Everyone uses “Visual Studio” For software, follow my steps below:

1.Visual StudioThere is a Debug and Release in the above place. After writing the code, change Debug to < strong>ReleaseClick.

2. In the project directory where you created this project, find the file Release

3. After opening, you can see a file with the suffix exe

4. Just send this to others

I hope this confession applet written in C language can help everyone?! ! !