Strange error with array

This is a discussion on Strange error with array within the C++ Programming forums, part of the General Programming Boards category; I'm working on a project for school in which we make an array and allow the user to add/delete products ...

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    3

    Strange error with array

    I'm working on a project for school in which we make an array and allow the user to add/delete products from the array. I've made it pretty far but I'm encountering a MASSIVE error when I try to compile it after I add in the code to add info to the price and/or quantity array (I'm assuming this has to do with the fact that they're doubles and ints respectively and not chars, though in all honesty, I have no idea what the problem is).

    Here's the code for the whole program:

    <<< try again >>>

    NOTE: I am not looking for someone to tell me how to do my program, I'm just asking for some help on this one issue. Thanks in advance.

    EDIT: /facepalm. After posting this thread and I tried to explain what I thought the error was, I was able to think it out and correct it. I changed the Pri and Qua arrays to chars rather than ints and now it's working fine. Sometimes just posting things and thinking about them a little further solves the problem

    Disregard this post and if any mods/admins would like to close it, please do.
    Last edited by Smallpox; 02-03-2011 at 09:50 PM. Reason: /facepalm; identified error.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,553
    I think you should read this, before anyone would bother to read that ^^^^
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    3
    Quote Originally Posted by Salem View Post
    I think you should read this, before anyone would bother to read that ^^^^
    And I think you should read this before posting anything. Obviously I already fixed it, so you posting anything doesn't really help. Trying to get your post count up much?

    Quote Originally Posted by Smallpox View Post

    EDIT: /facepalm. After posting this thread and I tried to explain what I thought the error was, I was able to think it out and correct it. I changed the Pri and Qua arrays to chars rather than ints and now it's working fine. Sometimes just posting things and thinking about them a little further solves the problem

    Disregard this post and if any mods/admins would like to close it, please do.

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    Quote Originally Posted by Smallpox View Post
    And I think you should read this before posting anything. Obviously I already fixed it, so you posting anything doesn't really help. Trying to get your post count up much?
    Salem - Smallpox => 0 - 1
    Devoted my life to programming...

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,553
    Funny, it still looks like unindented crap to me.

    I can fix that for you.

    There - much better.

    > Trying to get your post count up much?
    I've been here over a decade - why should I give a frig what some oik with 3 posts thinks about post counts.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    Don't be so picky, Salem. The guy was just making a joke.
    Devoted my life to programming...

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,553
    yeah - whatever.
    If they post more unindented code, I'll just do the same until they learn.
    Attached Images Attached Images  
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    How do they say it: Sticks and stones may break my bones but words will never hurt me?
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ordering an array in a 'strange' order.
    By Ziden in forum C++ Programming
    Replies: 3
    Last Post: 05-11-2010, 09:21 PM
  2. Code: An auto expanding array (or how to use gets() safely).
    By anonytmouse in forum Windows Programming
    Replies: 0
    Last Post: 08-10-2004, 12:13 AM
  3. Array help
    By deedlit in forum C Programming
    Replies: 4
    Last Post: 11-05-2003, 09:55 AM
  4. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM
  5. Array Program
    By emmx in forum C Programming
    Replies: 3
    Last Post: 08-31-2003, 12:44 AM

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