M
matthew.pugsley
Hello,
The following question concerns printing out some output and then
repositioning the cursor for input.
I am creating a native c++ console application. I would like to have
the user input a number of data items of type double. One way to do
this would be:
double jan, feb, mar;
cout << "Jan: ";
cin >> jan;
cout << "Feb: ";
cin >> feb;
cout << "Mar: ";
cin >> mar;
This would work, but well, it just looks clunky to me. It'd look more
polished to print out
Jan:
Feb:
Mar:
And then reposition input on the screen so that the user type a number
next to Jan, presses enter, then enters a number a next to Feb,
presses enter, then ... etc. until done.
I realize I could also use getline() for the input, but that doesn't
solve the problem of positioning input.
Also, I understand that there are lots of functions for peeking,
ignoring, etc. bits of input. But my understanding is that this just
allows you to play with the input buffer and read different parts of
the buffer into different variables. That has nothing to do with
controlling the location of screen output.
I also understand that a library for creaing guis with console
applications called "ncurses" exists for compiling on Unix-like
systems. But I'm using Microsoft Visual C++ 8 Express Edition on a
Windows Vista machine. So I can't use that.
I've tried many searches on Google and this newsgroup (variations of
"output around input", "control text location output native c++",
etc.). But no luck.
Can anyone point me in the right direction? Explanations or pointers
to a website tutorial would be equally welcome.
Thank you in advance!
Matthew Pugsley
The following question concerns printing out some output and then
repositioning the cursor for input.
I am creating a native c++ console application. I would like to have
the user input a number of data items of type double. One way to do
this would be:
double jan, feb, mar;
cout << "Jan: ";
cin >> jan;
cout << "Feb: ";
cin >> feb;
cout << "Mar: ";
cin >> mar;
This would work, but well, it just looks clunky to me. It'd look more
polished to print out
Jan:
Feb:
Mar:
And then reposition input on the screen so that the user type a number
next to Jan, presses enter, then enters a number a next to Feb,
presses enter, then ... etc. until done.
I realize I could also use getline() for the input, but that doesn't
solve the problem of positioning input.
Also, I understand that there are lots of functions for peeking,
ignoring, etc. bits of input. But my understanding is that this just
allows you to play with the input buffer and read different parts of
the buffer into different variables. That has nothing to do with
controlling the location of screen output.
I also understand that a library for creaing guis with console
applications called "ncurses" exists for compiling on Unix-like
systems. But I'm using Microsoft Visual C++ 8 Express Edition on a
Windows Vista machine. So I can't use that.
I've tried many searches on Google and this newsgroup (variations of
"output around input", "control text location output native c++",
etc.). But no luck.
Can anyone point me in the right direction? Explanations or pointers
to a website tutorial would be equally welcome.
Thank you in advance!
Matthew Pugsley