如何在VC++下实现滚动字幕
1个回答
展开全部
在VC++下实现滚动字幕代码可以参数一下下面:
#include <stdio.h>
#include <stdlib.h>
static void print_ctrl( char ctrl, int cnt )
{
int i = 0;
for( i = 0; i < cnt; i++ )
printf( "%c", ctrl );
}
void print_roll( const char str[] )
{
int i = 0;
int len = strlen( str );
for( i = 0; i < 50; i++ )
{
printf( " " );
printf( "%s", str );
print_ctrl( '\b', len );
sleep( 100 );
}
}
int main( int argc, char *argv[] )
{
print_roll( "abc" );
system("PAUSE");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
static void print_ctrl( char ctrl, int cnt )
{
int i = 0;
for( i = 0; i < cnt; i++ )
printf( "%c", ctrl );
}
void print_roll( const char str[] )
{
int i = 0;
int len = strlen( str );
for( i = 0; i < 50; i++ )
{
printf( " " );
printf( "%s", str );
print_ctrl( '\b', len );
sleep( 100 );
}
}
int main( int argc, char *argv[] )
{
print_roll( "abc" );
system("PAUSE");
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询