C语言实现从左向右字幕滚动的效果


#include <stdio.h>
#include <string.h>
#include <windows.h>
 
int main()
{
    char str[100] = "HELLO WORLD! GOOD BYE!";
    int i,j;
	while(1)
	{
		for(i=0;i<strlen(str);i++)
		{
			system("cls");
			for(j=i;j<strlen(str);j++)
			{
				printf("%c",str[j]);
			}
			Sleep(100);
			printf("\n");
		}
	}
    return 0;
}
system("CLS") 是在C语言程序中,调用系统命令cls完成清屏操作。
system("time /t") ;显示时间
system("dir"); //列目录
system("pause");来实现驻留。

system函数是C语言提供的与操作系统衔接的函数,函数原型如下:

#include <stdlib.h> //所在头文件
int system(const char *command); //参数为操作系统命令
函数功能:execute a shell command 执行一个操作系统命令 

  



 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM