brain itch

This is a discussion on brain itch within the C++ Programming forums, part of the General Programming Boards category; As many of you will know, for those that are in college finals are coming soon.I already have mine, and ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    brain itch

    As many of you will know, for those that are in college finals are coming soon.I already have mine, and well, i did crappy on it. I want to do the asignment right, just for pride reasons, and if this thread is deleted and or not answered, well i understand. but i have come to the conclusion my codeing is , well, in a word worse than the sound of nails on a chalkboard. so , i come to experts in giving me aid.

    the program details are thus:

    its a bank account program that allows the user to keep track of his checking account. the user can

    make deposits
    write checks
    do witdthdrawls
    search for check by payee
    search for check by date
    show listing of all deposits/checks made
    display current balance

    and saves and loads the information with the filenames of both input file and outputfile be chosen by the user.


    i have enclosed what i have sent in as my final, i appoligse for its patheticness
    Attached Files Attached Files

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    As it is, it is very rudimentary. The assignment is large and this has at best some 1% of it (wouldn't count as a fair effort to solve the problem oneself, IMO).

    Code:
    	case 2:
    	//inputting of checks
    	
    	cout<<"please enter the name of payee"<<endl;
    	cin>>payee;
    	cout<<"please enter the date the check was written."<<endl;
    	cin>>date;
    
    		break;
    Those variables are undeclared.

    The rest is more or less completely unimplemented. I suppose you need an array (container) of accounts and another one of checks. Then you go from there.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,282
    just for pride reasons
    >_<

    If that is what you sent for a final, you deserve to fail. You didn't even attempt to implement %80 of it. What did you expect? What do you want from this forum? The other %80 of the implementation?

    Pride? You have none.

    Soma

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    A development process
    Posting something which compiles would be good.
    It's just a lot of small steps, don't try to write the whole thing at once.

    Implementing each function, even if it's only
    Code:
    void balance ( void ) {
      cout << "This is balance" << endl;
    }
    With that, you can check all your menu code, user selection etc.

    Having done that, maybe have a think about what next...
    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.

  5. #5
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,246
    Quote Originally Posted by Salem View Post
    Writing the comments is the last step? Ugh.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #6
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Writing the comments is the last step? Ugh.
    I only write comments when I come back to my code later, can't understand some part of it, take an hour to figure it. Then I comment the thing that I couldn't understand at first for the future

    But even those comments have so far been useless, because when I come back again, I'd have problems with yet other parts of the program.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by brewbuck View Post
    Writing the comments is the last step? Ugh.
    Sometimes it's useful to write the comments only after you've written each function. But, usually, I agree, it's way better to write the comments as you go.

  8. #8
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,246
    Quote Originally Posted by EVOEx View Post
    Sometimes it's useful to write the comments only after you've written each function. But, usually, I agree, it's way better to write the comments as you go.
    I try to avoid commenting if possible, because it indicates the code isn't clear enough. But when a comment is truly necessary, I usually write it before writing the code itself.

    But back on topic, the best approach to a reasonably realistic problem such as this one, is to design and understand the necessary data structures before writing any code. Once the data structures are defined, the code will naturally fall out from that.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  9. #9
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by brewbuck View Post
    I try to avoid commenting if possible, because it indicates the code isn't clear enough. But when a comment is truly necessary, I usually write it before writing the code itself.
    I agree here, too. Most (95%) of my functions are less than 5 lines, in which case I generally don't write any comments, except for the per-function comment I always add. Usually, whenever a function needs a blank line, I also think it needs a comment - that's my rule of thumb, even though I don't always follow it myself.

  10. #10
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I use fewer comments than I see in most source and I feel guilty about it, which probably means I should add more at the end.

    Quote Originally Posted by brewbuck View Post
    I try to avoid commenting if possible, because it indicates the code isn't clear enough.
    Begs a lot of questions about how clear, etc. I'm usually conservative this way; I tend to think: this is clear enough. Then later I come back and think hey, you know a couple of words here will save you a couple of minutes later on, every time you come back. So the first time I come back and recognize that, I add the comment.

    I guess if we were all omniscient this would not be a problem, but IMO current standard practices wrt documenting code are way, way, way behind current standards wrt coding itself. So I don't feel too guilty.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  11. #11
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    Feel free to post an updated guide...
    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.

  12. #12
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,282
    ^_^v

    Code:
    while(problem_not_solved)
    {
       think();
    }
    code();

  13. #13
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Salem View Post
    Feel free to post an updated guide...
    I keep meaning to do something on a couple of related issues:

    1) How to premise test syntax usage.
    2) How/why to write "as short an example as possible which demonstrates a specific problem".
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Left Brain v Right Brain
    By stevesmithx in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-30-2008, 09:13 AM
  2. Human brain and programing
    By avgprogamerjoe in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 08-27-2007, 04:48 PM
  3. Mouse to have human brain
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 03-10-2005, 04:39 PM
  4. brain vs. computer (brain wins hands down)
    By hk_mp5kpdw in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 09-17-2003, 08:41 PM
  5. Re: Girlfriend Post
    By PsychoBrat in forum A Brief History of Cprogramming.com
    Replies: 57
    Last Post: 05-13-2002, 06:11 AM

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