C言語なら俺に聞け(入門篇) Part 23
at TECH
805:デフォルトの名無しさん
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
5501日前に更新/237 KB
担当:undef