C言語なら俺に聞け(入門篇) Part 23at TECH
C言語なら俺に聞け(入門篇) Part 23 - 暇つぶし2ch805:デフォルトの名無しさん
08/01/14 11:58:06
// >>801
#include <stdio.h>
#include <string.h>

void func(int width, const char * str)
{
int len = strlen(str);
for (int ic = 0; ic <= len; ++ic) {
printf("\r%*.*s", width, ic, str);
fflush(stdout);
sleep(1);
}
for (int ic = 0; ic < width; ++ic) {
printf("\r%*s%*s", width - 1 - ic,
ic < width - len ? str : str + ic + 1 - width + len,
ic + 1, "");
fflush(stdout);
sleep(1);
}
}

int main()
{
func(20, "abcde");
return 0;
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch