A couple of questions on console program

S

Sam Hu

Hello,

I am always wondering,in many console apps I have ever seen,how one
can make this in C++:

1.password mask "*",when one is asked to enter the password ,say
"1234",it displays "****";
2.progress indidating.say when one want to show the completeness by
percentage of the current task going,other than showing below
information:

copying files 5% completed.
copying files 6% completed.
.....
how one just let show in a single line:

copying files xx% completed

only the percentage is increasing or decreasing in certain interval.

3.how to ask the user to input in a fixed position,say below prompt
from an app:

your name is ____ and you are __ years old.
The cursor is exact at the postion after "is ".
when the user input a string and hit some key,the cursor is re-
positioned at the point exact after "are ".Another word,something like
the BIOS setup ultility.

4.someone told me that one can play a music/song on the keyboard,how?
5.how to create a menu just like the BIOS setup ultility?
6.how to display an icon/logo,just like the one Norton Ghost does.

It would be grateful if someone can help.

Regards,
Sam
 
O

osmium

Sam Hu said:
I am always wondering,in many console apps I have ever seen,how one
can make this in C++:

1.password mask "*",when one is asked to enter the password ,say
"1234",it displays "****";
2.progress indidating.say when one want to show the completeness by
percentage of the current task going,other than showing below
information:

copying files 5% completed.
copying files 6% completed.
....
how one just let show in a single line:

copying files xx% completed

only the percentage is increasing or decreasing in certain interval.

3.how to ask the user to input in a fixed position,say below prompt
from an app:

your name is ____ and you are __ years old.
The cursor is exact at the postion after "is ".
when the user input a string and hit some key,the cursor is re-
positioned at the point exact after "are ".

You can't do these with the basic offerings. Look for <conio.h> it will
answer many, perhaps all of those questions. You can dig through the
newsgroup archives for a start. Your (later) mention of Norton Ghost makes
me think you are using something related to Windows. The include file is
different for Unix.
 
L

Linlin Yan

I am afraid that some of your questions are off-topic in comp.lang.c+
+. They depend on different platform. You can try to find some
libraries such as
curses which enable you control the screen cursor and output styles.

Hello,

I am always wondering,in many console apps I have ever seen,how one
can make this in C++:

1.password mask "*",when one is asked to enter the password ,say
"1234",it displays "****";
2.progress indidating.say when one want to show the completeness by
percentage of the current task going,other than showing  below
information:

copying files 5% completed.
copying files 6% completed.
....
how one just let show in a single line:

copying files xx% completed
this can be easily used like:
printf("copying files %d%% completed.\r", progress);
fflush(stdout);
 
J

Juha Nieminen

Linlin said:
this can be easily used like:
printf("copying files %d%% completed.\r", progress);
fflush(stdout);

Since this is a C++ group, let's also give the more C++'ish solution:

std::cout << "Copying files " << progress << "% completed.\r"
<< std::flush;
 
J

James Kanze

I am always wondering,in many console apps I have ever
seen,how one can make this in C++:
1.password mask "*",when one is asked to enter the password ,say
"1234",it displays "****";
2.progress indidating.say when one want to show the completeness by
percentage of the current task going,other than showing below
information:
copying files 5% completed.
copying files 6% completed.
....
how one just let show in a single line:
copying files xx% completed
only the percentage is increasing or decreasing in certain interval.
3.how to ask the user to input in a fixed position,say below prompt
from an app:
your name is ____ and you are __ years old.
The cursor is exact at the postion after "is ".
when the user input a string and hit some key,the cursor is re-
positioned at the point exact after "are ".Another word,something like
the BIOS setup ultility.

None of the above is supported by standard C++. Typically,
you'll either need something platform specific, or a portable
library---ncurses is almost a standard for this sort of thing.
4.someone told me that one can play a music/song on the keyboard,how?

Who knows? The machines I usually work on don't have any such
possibility (the only sound they support is the beep from the
keyboard), and it's not supported by C++.
5.how to create a menu just like the BIOS setup ultility?

ncurses? (I don't really know what the BIOS setup utility menu
looks like.)
6.how to display an icon/logo,just like the one Norton Ghost does.

You need to use the GUI. Again, implementation dependent, or an
external library (wxWidgets, etc.).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top