Class

Nov 10, 2018 at 6:05pm
[CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE] [CLOSE]
Last edited on Nov 30, 2018 at 7:59am
Nov 11, 2018 at 9:19am
*Phone number and zip code shows a dot at the end of course because setprecision 0 but if i dont have it will show .00 at the end of each on.


Use a string.
Nov 11, 2018 at 2:45pm
You should of course use a string since a phone number isn't a number (you don't do arithmetic with it) but just a string of digits.

However, I find it strange that showpoint (showing the decimal point even if there's no digits after it) would be set by default.
Last edited on Nov 11, 2018 at 2:46pm
Nov 11, 2018 at 9:21pm
Thank you both of you. Yeah i mean i tried first without the showpoint but the phone numbers was print like 8888888888.00 and zipcode 77777.00 even when it did not have the showpoint.

Then i was trying to leave it in number data format so i can validate the input. it should not allow the user enter letter on those two, and im trying to that in class function but im not sure how.

Do you know why NewPatient.getStreet() is not showing anything when im running the program?

thank you again.
Nov 11, 2018 at 9:37pm
Then i was trying to leave it in number data format so i can validate the input.


Look at each element in the string. If that element (a char) is not a number, reject the input.
Nov 11, 2018 at 9:49pm
Is there a way to do here void Patient::setPhoneNumber(string pn)
{ phoneNumber = pn; }

or does it has to be in function where im entering the input?
Nov 12, 2018 at 11:22am
Doing it where you gather the input seems sensible. If you wait until setPhoneNumber and then decide you don't like the input, how will you get fresh input?
Nov 12, 2018 at 12:13pm
as I got it, use string then you will not face such issues.
Topic archived. No new replies allowed.