//#include <windows.h> // (Windows)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> // (Linux)
// 表示器
void display_machine(char *d, int len)
{
char c;
int i;
// 表示文字数分だけ表示
for (i = 0; i < len; i++) {
}
// ・左スライド
// ・あふれる文字を(表示文字の2倍の長さの)バッファの最後端に移動
c = d[0];
d[len * 2 - 1] = c;
}
// main
int main()
{
char *buff; // 表示文字の2倍の長さのバッファ
int i;
char *h_moji = "HyoujiMoji"; // 表示文字
int len
= strlen(h_moji
); // 表示文字の長さ int n = len * 4 + 1; // スライド回数
buff
= (char *) malloc(len
* 2); for (i = 0; i < n; i++) {
display_machine(buff, len);
sleep(1); // 1秒ウェイト (Linux)
//Sleep(1000); // 1秒ウェイト (Windows)
}
return 0;
}
Ly8jaW5jbHVkZSA8d2luZG93cy5oPiAgICAgICAgICAgIC8vIChXaW5kb3dzKQojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDx1bmlzdGQuaD4gICAgICAgICAgICAgLy8gKExpbnV4KQoKLy8g6KGo56S65ZmoCnZvaWQgZGlzcGxheV9tYWNoaW5lKGNoYXIgKmQsIGludCBsZW4pCnsKICAgIGNoYXIgYzsKICAgIGludCBpOwoKICAgIC8vIOihqOekuuaWh+Wtl+aVsOWIhuOBoOOBkeihqOekugogICAgZnByaW50ZihzdGRlcnIsICJcciIpOwogICAgZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgZnByaW50ZihzdGRlcnIsICIlYyIsIGRbaV0pOwogICAgfQogICAgLy8g44O75bem44K544Op44Kk44OJCiAgICAvLyDjg7vjgYLjgbXjgozjgovmloflrZfjgpIo6KGo56S65paH5a2X44GuMuWAjeOBrumVt+OBleOBrinjg5Djg4Pjg5XjgqHjga7mnIDlvoznq6/jgavnp7vli5UKICAgIGMgPSBkWzBdOwogICAgbWVtbW92ZShkLCBkICsgMSwgbGVuICogMiAtIDEpOwogICAgZFtsZW4gKiAyIC0gMV0gPSBjOwp9CgovLyAgICAgIG1haW4KaW50IG1haW4oKQp7CiAgICBjaGFyICpidWZmOyAgICAgICAgICAgICAgICAgICAgIC8vIOihqOekuuaWh+Wtl+OBrjLlgI3jga7plbfjgZXjga7jg5Djg4Pjg5XjgqEKICAgIGludCBpOwogICAgY2hhciAqaF9tb2ppID0gIkh5b3VqaU1vamkiOyAgICAvLyDooajnpLrmloflrZcKICAgIGludCBsZW4gPSBzdHJsZW4oaF9tb2ppKTsgICAgICAgLy8g6KGo56S65paH5a2X44Gu6ZW344GVCiAgICBpbnQgbiA9IGxlbiAqIDQgKyAxOyAgICAgICAgICAgIC8vIOOCueODqeOCpOODieWbnuaVsAoKICAgIGJ1ZmYgPSAoY2hhciAqKSBtYWxsb2MobGVuICogMik7CiAgICBtZW1zZXQoYnVmZiwgJyAnLCBsZW4gKiAyKTsKICAgIG1lbW1vdmUoYnVmZiwgaF9tb2ppLCBsZW4pOwogICAgZm9yIChpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGRpc3BsYXlfbWFjaGluZShidWZmLCBsZW4pOwogICAgICAgIHNsZWVwKDEpOyAgICAgICAgICAgICAgIC8vIDHnp5LjgqbjgqfjgqTjg4ggKExpbnV4KQogICAgICAgIC8vU2xlZXAoMTAwMCk7ICAgICAgICAgICAgLy8gMeenkuOCpuOCp+OCpOODiCAoV2luZG93cykKICAgIH0KICAgIGZyZWUoYnVmZik7CgogICAgcmV0dXJuIDA7Cn0K