Use vector instead of fixed-size array

This is a discussion on Use vector instead of fixed-size array within the C++ Programming forums, part of the General Programming Boards category; So should I change type of my price vector to string and that will eliminate ALL issues with reading in ...

  1. #16
    Registered User
    Join Date
    Sep 2007
    Location
    Arizona
    Posts
    164
    So should I change type of my price vector to string and that will eliminate ALL issues with reading in thefile correctly?

  2. #17
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    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.

  3. #18
    Registered User
    Join Date
    Sep 2007
    Location
    Arizona
    Posts
    164
    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.

  4. #19
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    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.

  5. #20
    Registered User
    Join Date
    Sep 2007
    Location
    Arizona
    Posts
    164
    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.
    Last edited by clegs; 09-16-2007 at 09:03 PM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 04:05 AM
  2. size of array
    By goran00 in forum C Programming
    Replies: 38
    Last Post: 04-02-2008, 09:57 AM
  3. Little Array Difficulty
    By G4B3 in forum C Programming
    Replies: 16
    Last Post: 03-19-2008, 12:59 AM
  4. How do you use variable to initialize array size?
    By yougene in forum C Programming
    Replies: 11
    Last Post: 09-04-2007, 02:50 PM
  5. Maximum array size?
    By code2big in forum C Programming
    Replies: 2
    Last Post: 05-25-2004, 08:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21