I am trying to make a marquee, I have made this where the text maves from right to left and also where the text first moves left to right and then right to left.
What I am trying to do is that when the text moves from left to right it should come out one by one. For example
o
lo
llo
ello
Hello
Similarly the text should go out of the screen in the same manner
For example
Hello
Hell
Hel
He
H
The Coding for the same is
Code:#include<iostream> #include<dos.h> #include<conio.h> class marquee { int a,b,x,y,z; char c[50]; public: void display() { cout<<"\nPlease Enter your Name:";cin>>c; cout<<"\nEnter a Choice. 1 for Rotating and 2 for Bouncing: ";cin>>z; for(y=0;c[y]!='\0';y++); if(z==2) { for(x=1;x>0;x++) { for(a=1;a<80-y;a++) { for(b=1;b<=a;b++) { clrscr(); cout<<" "; } cout<<c<<"\n"; delay(50000000); } for(a=80-y;a>y;a--) { for(b=1;b<=a;b++) { clrscr(); cout<<" "; } cout<<c<<"\n"; delay(50000000); } } clrscr(); } else if (z==1) { for(x=1;x>0;x++) { for(z=1;z<=x;z++) \\Starting { cout<<c[y];y--; } for(a=1;a<80-y;a++) \\Middle { for(b=1;b<=a;b++) { clrscr(); cout<<" "; } cout<<c<<"\n"; delay(50000000); } } clrscr(); } else cout<<"\nERROR!!!\nYou have entered a wrong choice. Run the program again."; } }; void main() { marquee view; view.display(); }


Reply With Quote

Bookmarks