-
How To Scroll Your Text
Code:
#include <string.h>
#include <conio.h>
#include <ctype.h>
#include <windows.h>
int main(int argc, char *argv[])
{
char sentzz[]="HELLO I AM A TEXT SCROLL\n"
"
int x; //special dialogue
int size;
size=strlen(senta);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",senta[x]);
}
getch();
}
-
it would be a great idea to include some description, such as "i'm getting some build errors I can't decipher" or "point out where my logic is wrong." I can tell you that you're missing a semi colon after the text string, and you're taking the strlen of senta, which is undeclared. You're also indexing senta.
-
Sorry, I mis typed a little!
1. REPLACE the zz in char sentzz and make it read char senta[]="Hello Im Text\n";
because you have already declared x and size, you should get NO compile errors.
I do appoligise for my prevoius post, I was a little tired.
-
Here is a scroller program that i made
Code:
/*
Name: Scroller
Copyright: 2005
Author: Sridar Ravi
Date: 05/04/05 18:31
Description: A scrolling text program
*/
#include <iostream>
#include <time.h>
using namespace std;
//*****************************************************************************
void wait(long milliseconds)
{
long timeout = clock() + milliseconds;
while( clock() < timeout ) continue;
}
void Scroll(string &msg)
{
string scrolled,temp,temp2;
temp=msg.substr(1,(msg.length()));
temp2=msg.substr(0,1);
msg=temp+temp2;
if(msg.length()+1==' ')
{
cout<<temp+' '+temp2;
}
else
{
cout<<msg;
}
}
//*****************************************************************************
int main()
{
string msg;
cout<<"Enter the message that you wish to display as scroller: ";
getline(cin,msg);
msg=msg+". ";
int x=0;
while(1)
{
Scroll(msg);
wait(100);
system("cls");
x++;
}
cin.get();
return 0;
}
Hope it helps.