Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

input and get an answer at same line?

whenever i ask the user to enter data in ms-dos, the user enters something on the keyboard and then presses enter and sees the outout on the next line. Is there any way i can see the output at same line?
0
Carl3003
Asked:
Carl3003
  • 4
  • 4
  • 2
  • +2
1 Solution
 
info_expertCommented:
You can give the position of out put by just using the function gotoxy(x,y)\

Just use this function in this way:

gotoxy(x,y);
cout<<//your output;


Regards.
0
 
Carl3003Author Commented:
thanks, its an intersting idea but the user would need to enter huge  bunch of data and that would cause me lots of troubles outputing data
0
 
Carl3003Author Commented:
And the thing is that i dont know when the user will want to output the data, thats why x,y should be always increasing
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
caner_elciCommented:
You should write your own input function.. A loop with getch() from stdin and waits for CR.. but you will need to implement arrow keys (if you want), backspace etc... and at the end, you won't print CR, that's it..
0
 
MafaldaCommented:
Could you please show us your code ?
0
 
caner_elciCommented:
Alright, but in a few hours.. I need a compiler first :)
By the way, what compiler and OS do you use?
0
 
caner_elciCommented:
A misunderstanding? do you wanna see my code, or Carl's code?
0
 
MafaldaCommented:
The code of Carl3003 of course ;o)
The one doing this input output stuff
0
 
caner_elciCommented:
Yeah, I thought so :)
In fact the problem is that I didn't check you posted that comment and thought Carl3003 did it :) Anyway, I am willing to show you a code.. soon :))
0
 
Carl3003Author Commented:
I use VS 6
0
 
info_expertCommented:
Ok then, use getx and gety functions to get the current positins of the cursor.

Got?
0
 
Carl3003Author Commented:
do you  have any sample code how to use getx?
0
 
GhostModCommented:
PAQed, with points refunded (75)

GhostMod
Community Support Moderator
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now