Acrostic (15 points) (c plain language version)

This question requires the preparation of a program to decrypt the acrostic.

Input formats:
input is a Chinese acrostic, a total of four, the end of each line. Note: a character occupies two bytes.

Output format:
Remove the first character of each sentence and connected together to form a string output. Enter a newline at the same time.

Sample input:
canoe to the east
slightly Qingwo hand sail willow
wind blue micro fiber dance
smooth traffic from any Ya

Sample output:
smooth sailing

#include <stdio.h>
#define N 4

int main()
{
    char a[4][20];
    int i;

    for (i = 0; i < N; i++)
        scanf("%s", a[i]);
    for (i = 0; i < N; i++)
        printf("%c%c", a[i][0], a[i][1]);   //一个char是一个字节,而一个汉字占两个字节,所以要输出每一行数组的前两个才是一个汉字。
    printf("\n");

    return 0;
}
Published 24 original articles · won praise 0 · Views 152

Guess you like

Origin blog.csdn.net/qq_45624989/article/details/105086845