changing the values of the array elements

This is a discussion on changing the values of the array elements within the C++ Programming forums, part of the General Programming Boards category; hey guys i'm just new here and i would like some help with my school work. what i'm trying to ...

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

    changing the values of the array elements

    hey guys i'm just new here and i would like some help with my school work. what i'm trying to do is change the values inside the arrays which in this case is a country code. don't mind the country code i just made that up. i would like some help or some improvements in my code tnx. if you could reply asap it would be a great help tnx.

    * i'm using borland c++
    Attached Files Attached Files
    Last edited by yugidallin; 01-01-2013 at 03:35 AM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,647
    Please post you code in [code][/code] bbcode tags instead of attaching it.

    Anyway, the problems that jump out at me are:
    • You have a main function that is more than 230 lines long. Rather, functions should do one thing and do it well. Break up your main functions into smaller functions, say no more than 50 lines each.
    • Your code lacks proper indentation.
    • You use goto when it appears to be completely unnecessary. It is hard to see the structure of your code because of the lack of indentation, but my guess is that your whole goto scheme is a farce: control would have gone to the label point even without the use of goto.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jan 2013
    Posts
    3
    Quote Originally Posted by laserlight View Post
    Please post you code in [code][/code] bbcode tags instead of attaching it.

    Anyway, the problems that jump out at me are:
    • You have a main function that is more than 230 lines long. Rather, functions should do one thing and do it well. Break up your main functions into smaller functions, say no more than 50 lines each.
    • Your code lacks proper indentation.
    • You use goto when it appears to be completely unnecessary. It is hard to see the structure of your code because of the lack of indentation, but my guess is that your whole goto scheme is a farce: control would have gone to the label point even without the use of goto.

    thanks for the feed.
    can you show me how to do that "farce" i'm kinda newbie here , sorry for the attachment thing i'm also new to these forums

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,261
    The word "farce" refers to an action that is silly. By asking how to do that, you have committed a farce.

    Anyway, it is clear that your english expression isn't the best, so bear with us if there is misunderstanding.

    Laserlight's point is to break your code into smaller functions, post in directly with [code] tags, and it is better to avoid using "goto".
    Last edited by grumpy; 01-01-2013 at 06:27 AM.
    Right 98% of the time, and don't care about the other 3%.

  5. #5
    Registered User
    Join Date
    Jan 2013
    Posts
    3
    it's 2% haha

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do I assign values to elements of a 2D array?
    By Karyumi in forum C Programming
    Replies: 9
    Last Post: 06-21-2012, 02:48 PM
  2. Replies: 3
    Last Post: 10-21-2010, 12:39 PM
  3. Replies: 9
    Last Post: 05-29-2010, 10:32 AM
  4. stored values in elements of array, help
    By houler in forum C Programming
    Replies: 5
    Last Post: 12-09-2004, 03:19 PM
  5. Array elements values not being assigned
    By Sardien in forum C Programming
    Replies: 4
    Last Post: 02-11-2002, 12:45 PM

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