So should I change type of my price vector to string and that will eliminate ALL issues with reading in thefile correctly?
Printable View
So should I change type of my price vector to string and that will eliminate ALL issues with reading in thefile correctly?
give it a shot and find out.
it would be a little more work to remove the $ in the file and just use two double's and making it error-proof, but would be better i think.
I tried it and becasue I had the '.' aligned in my text file, there were spaces between the '$' and the number on some prices. That means those didn't display anything except the '$'. So I eliminated the spaces and it prints correctly. I don't know what my best solution is. I think I am doing more than expected for this program assignment, but my intent is to learn the language and all its nuances not just pass the class. I may just go with it as is and move on to the next problem.
This class is tough. It is an online class. There are 6 tests. The first 5 have 6 programs to write; the last has 9 and there are 9 more labs programs besides and the text is 850 pages. I am to have it all done in 8 weeks.
if you have a lot of other work to do then it would probably be best to continue. since it seems you have completed the assignment to their requirements, and, more importantly, understand the flaws in their specifications and realize how to improve the program to make it more user-friendly and bug-free.
again, i would think allowing for 2 doubles on a line, product number first and price second, with no restriction on spacing, would be the best solution.
if this is an 'advanced' or sped-up course, you can now see the major downside to it: you will have the same amount of content to be covered, in a shortened period. often in beginner programming courses they require you to do many programs with the goal of having the expected output when a specific input is given. this is opposed to having the program work _completely_ and efficiently.
This is an intro course. But the time limit is a standard time limit for this university. I have been trying to convince the 'decision makers' that someone needs to evaluate the content of the classes to make sure the 'average student' can complete the course in the time allowed, especially with the lack of response from the instructors.
So far no one is listening.
I have been working on this class for 36 days with one more program for test 5 before moving onto test 6. So I am doing well, but...I have to have this class and the next one - Data Structures (35 programs) done by October 29th because of other issues with other classes. It is a pressure cooker.
So I thank you immensely for your help.