Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,755 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,446 people online right now. Registration is fast and FREE... Join Now!




how to continue printing in next window

 
Reply to this topicStart new topic

how to continue printing in next window, use c

vsrik015
23 Feb, 2007 - 10:10 AM
Post #1

New D.I.C Head
*

Joined: 27 Jan, 2007
Posts: 14


My Contributions
// i am using turbo c++ 3.0 compiler
// how to continue printing the next letter 'r' after 's' .After 's' is printed from top to bottom ,the letter 'r' is getting //printed in first line itself. What should be done to print 'r' in the same way as 's' is done from top to bottom of //screen .

CODE

#include<dos.h>
#include <conio.h>
#include<stdio.h>
int main(void)
{
   int x=0,y=0,i,j;
   char s[]="sr";
   for(j=0;j<2;j++)
   {
    for(i=0;i<25;i++)
    {
      clrscr();          
       x++;
       y++;
      gotoxy(x,y);
      printf("%c",s[j]);
      sleep(1);
    }
   }
   getch();
   return 0;
}

User is offlineProfile CardPM
+Quote Post

vsrik015
RE: How To Continue Printing In Next Window
23 Feb, 2007 - 10:57 AM
Post #2

New D.I.C Head
*

Joined: 27 Jan, 2007
Posts: 14


My Contributions
need help
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: How To Continue Printing In Next Window
23 Feb, 2007 - 01:27 PM
Post #3

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,869



Thanked: 53 times
Dream Kudos: 550
My Contributions
what do you want your output to look like? right now it looks like you want:

rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
sssssssssssssssssssssssssssss
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
sssssssssssssssssssssssssssss
etc...

that is rather easy:
CODE
char ch[2]="rs"
int row, col;
for (row=0; row<25;row ++)
{
for (col=0; col<80; col++)
{
gotoxy(row, col);
printf("%c", ch[row % 2]);
}
}

User is offlineProfile CardPM
+Quote Post

vsrik015
RE: How To Continue Printing In Next Window
24 Feb, 2007 - 10:28 AM
Post #4

New D.I.C Head
*

Joined: 27 Jan, 2007
Posts: 14


My Contributions
not just printing like this

rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
sssssssssssssssssssssssssssss
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
sssssssssssssssssssssssssssss

first r is printed from top to bottom and each printed letter is cleared using clrscr().
After r is printed from top to bottom then the process should continue with s in next screen .
As it is not possible to print 'r' in same screen because atmost 24 lines is visible in one screen.
CODE

#include<dos.h>
#include <conio.h>
#include<stdio.h>
int main(void)
{
int x=0,y=0,i,j;
char s[]="sr";
for(j=0;j<2;j++)
{
for(i=0;i<25;i++)
{
clrscr();
x++;
y++;
gotoxy(x,y);
printf("%c",s[j]);
sleep(1);
}
}
getch();
return 0;
}

User is offlineProfile CardPM
+Quote Post

vsrik015
RE: How To Continue Printing In Next Window
24 Feb, 2007 - 11:49 AM
Post #5

New D.I.C Head
*

Joined: 27 Jan, 2007
Posts: 14


My Contributions
anyone help
User is offlineProfile CardPM
+Quote Post

vsrik015
RE: How To Continue Printing In Next Window
24 Feb, 2007 - 12:22 PM
Post #6

New D.I.C Head
*

Joined: 27 Jan, 2007
Posts: 14


My Contributions
I need help for this piece of code.
NickDMax can u help me.
User is offlineProfile CardPM
+Quote Post

vsrik015
RE: How To Continue Printing In Next Window
24 Feb, 2007 - 12:30 PM
Post #7

New D.I.C Head
*

Joined: 27 Jan, 2007
Posts: 14


My Contributions
Craige, Captain M, horace, tibugeorge, ripsta, keems21 any one please kindly help
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: How To Continue Printing In Next Window
24 Feb, 2007 - 02:58 PM
Post #8

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,869



Thanked: 53 times
Dream Kudos: 550
My Contributions
Well, I would help but I get the feeling that you are not really thinking about this. The code I posted before has all you need in it, the code you posted just needs a little tweeking. THINK about it. all you have to do is print the letter out, clear the screen, print the next letter our.

Programming is largly about salving problems with the tools at hand. Each language and each environment has its own set tools. The above posts demonstrate all of the tool you need, TRY and TRY again to use them to solve your problem. If you don't get it right, LOOK at what DID happen and ask yourself "Why did it do that?" and when you have ansered that, ask yourself, "Where did I go wrong?"

This post has been edited by NickDMax: 24 Feb, 2007 - 03:02 PM
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 05:53AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month