debugging

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samimmu
    New Member
    • Mar 2007
    • 32

    debugging

    hey guys. please i need your help urgently. your help is highly appreciated. actually i have done this code for my assignment but unfortunately i couldn't run, particularly when i press the 1 to add data the program terminated, i wish you guys can do me a little favor by debugging this code and send it to me back.....

    thank you



    Full code removed per Posting Guidelines
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    This is non-standard C++:
    Originally posted by samimmu
    int n;
    string name;
    double otheritem [n]; <<<<<<<<<<<<< <<
    The size of stack arrays, like otheritem, needs to be known at compile time. The value of n is not known until reun time. As a result I can't even compile your code. It appears you are using g++, and if so, you should be using the
    -pedantic switch to disable non-standard language extensions. All compilers have this feature and it's an attempt by the compiler vendor to trap you into using their compiler forever.

    Next, your classes have no construcrtors so your data members are garbage.

    Next, the menu choice youe enter should be an int and not a string.

    Next, all screeen displays should be outside your class member functions. The way things are coded, your screen layout is intertwined with your data. There is now no chance of reusing your class in another program because your screen layout is dragged along with it. You may as well not use a class at all and code everything in main().

    Next, none of your class member functions have any arguments. I expect you may not know how to design these member functions so instead your coded the application inside the methods.

    That's all I have for now. Please post again when you get this cleaned up.

    Comment

    • samimmu
      New Member
      • Mar 2007
      • 32

      #3
      Originally posted by weaknessforcats
      This is non-standard C++:


      The size of stack arrays, like otheritem, needs to be known at compile time. The value of n is not known until reun time. As a result I can't even compile your code. It appears you are using g++, and if so, you should be using the
      -pedantic switch to disable non-standard language extensions. All compilers have this feature and it's an attempt by the compiler vendor to trap you into using their compiler forever.

      Next, your classes have no construcrtors so your data members are garbage.

      Next, the menu choice youe enter should be an int and not a string.

      Next, all screeen displays should be outside your class member functions. The way things are coded, your screen layout is intertwined with your data. There is now no chance of reusing your class in another program because your screen layout is dragged along with it. You may as well not use a class at all and code everything in main().

      Next, none of your class member functions have any arguments. I expect you may not know how to design these member functions so instead your coded the application inside the methods.

      That's all I have for now. Please post again when you get this cleaned up.
      honestly; i am not familiar with classes even my programing experience or skill not really enough good. i just started studying c++. so i tried that out and i wanted to get ur view about it, your view would help me alot


      thank you so much for ur reply, i hope u can teach me more to learn about classes

      Comment

      Working...