thanks
thanks
Last edited by nadeni0119; 03-24-2003 at 10:50 PM.
You want :
- the user to input a number and instead of digits the user should see * ?
You want to input a string but output *'s? In that case then you could probably use a loop of getchars and cout a * for every character read, store it in an array of chars and then if they press a backspace you could always move backwards in the array one character.
That is, if thats what you mean.
~ Paul
So, that is the Idea. But, if You want somth else, please reply
Lull!
http://friedegg.hit.bg
I can't remember if it's in <iostream> or <iomanip>, but there exists a function fill that will fill the leading whitespace with the character of your choice so that you could do something like:
Code:***************$123.45
FAQ
"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.
"If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.
you need to #include "apstring.h" or I believe borland can do #include <apstring.h>
the two errors are because of this missing include.
edit: but if this is part of an AP class, and you have the header file, it should be in " ", such as the first example.
I'm not familiar with "apstring".
on line 10 you have:
apstring amount;// invalid: apstring has not been declared (but you could say
string amount;
on line 15:
while(x < amount.length());// for this to work you must fix the previous error first
You don't need that loop to find the '.'; look up the find() function which you can use to locate the decimal point.
But anyway, WHY are you looking for the decimal point, and what are you trying to do with "Dollar and" and "cents", since you said that you want to print this ****99.87 format?
If your dollar amount is in a string you can use insert() to place a $in front of the amount (look up string functions for the parameters).
Then you can use
cout << setw(n) where n is the desired field width
and
cout << setfill(*) to fill the field with leading *s.