求一条c语言指令 我想写一些话 用printf输出 但每句话中间想要有一段时间的间隔 不知道应该用什么指令

求大神请教

#include <stdio.h>
#include <windows.h>
#define STR_PRINTF "This is C\n"
int main(void)
{
printf("Hello Word!\n");
Sleep(1000);//毫秒为单位
printf(STR_PRINTF);
return 0;
}
好心的楼主,如果可以就采纳吧!追问

hello world是直接跳出来的 然后我要插进去的话应该怎么加呢 return 0和printf(STR_PRINTF);是什么意思..最后我的getchar()没法让那个框停止着不关闭诶

追答

插进哪里去???
getchar不行就用system("pause");

printf(STR_PRINTF);//是打印一个字符串常量、

等同于printf("This is C\n");

温馨提示:内容为网友见解,仅供参考
第1个回答  2013-02-14
#include <stdio.h>
#include <unistd.h>
int main(void)
{
char a[] = "hello world";
char *p = a;
while(1)
{
if(*p != '\0')
{
putchar(p);
Sleep(1000);
}
else break;
}
return 0;
}
第2个回答  2013-02-14
用sleep();
比如
printf(".......");
sleep(间隔的秒数);
printf(".........");
另外usleep(间隔的微秒)
第3个回答  2013-02-14
每一个printf后面加个掩饰函数好了
第4个回答  2013-02-14
加个sleep();函数就行了吧
相似回答