I'm sorry i didn't mean to just blow it of. I meant it's not breaking the code as far as I've checked. I was simply asking if you knew the source of the problem for the output, but honestly I didn't mean to undermine your suggestion. I have remembered your suggestion and will take the time to read on the subjects you provided, but if it's not breaking the code I simply don't have the time to study why gets() and fflush is bad.
Pardon me I just want to get the critical errors fixed before I go into fflush and gets. I was thought all year that they work and they have so I see no reason as of this particular moment to focus my and your time on such a trivial error (Unless you believe otherwise, in which case I have already stated that I will research as to what problems both of those statements can cause).
Now I don't want to be anymore of a douche, so I simply ask if you could help me find the source of the error, which is the bugged output from file (Assignment requires for me to save the data to file, load and print it.)
Well for one thing... look at your struct... if you enter too much text at the fgets() call it's going to overwrite the rest of your struct, so it's entirely possible that's been your problem --as we've been telling you-- right from the start.
Straight up... given the structure of your program, which looks more like someone playing than anything else, your use of deprecated functions and the pointless inclusion of irrelevant code... my grade to you would be an F.
Last edited by CommonTater; 12-10-2011 at 07:56 PM.
Wow. Umm. I really have not much to say. Thanks for the advice. I don't know who you are, or how good of a programmer you are, but I'm a 19 y.o. dude who's just finishing up his first class in programming, so pardon my "using of deprecated functions" and "pointless inclusions". I write code neatly and make it fun, but since you are so kind to have given me such a low grade it seems like you are a dull and a sad programmer.
I just asked if you could find a solution where I have failed, not criticize me and my code for my lack of knowledge. Oh and did I ask for a letter grade? No. So if you would like to be a teacher you can do that elsewhere. I came for advice for a specific question. If you are so kind to have provide it (Which I believe you have, at least slightly), I would be in great debt.
So far I have received "pointless" criticism and no clear statement as to what line of code is causing this:
Code:Hello, DaveEnter the Stock Name >Clippers Enter the Number of Shares >150 Enter the Buying Price Per Share >1.33 Enter the Current Price Per Share >3.33 Enter the Yearly Fees >5.00 Enter the Stock Name >Spurs Enter the Number of Shares >215 Enter the Buying Price Per Share >15.77 Enter the Current Price Per Share >14.25 Enter the Yearly Fees >3.50 The stock is Clippers With Initial cost of $199.50 Current cost is $499.50 And your Profit is $295.00 The stock is Spurs With Initial cost of $3390.55 Current cost is $3063.75 And your Profit is $-330.30 1 of stocks broke Positive 1 of stocks broke Negative 0 of stocks broke Even The Total Trofit is $-35.300049 The stock is Clippers With Initial cost of $0.00 Current cost is $-1.#J And your Profit is $-1.#J The stock is With Initial cost of $3390.55 Current cost is $3063.75 And your Profit is $-330.30 The stock is Clippers With Initial cost of $0.00 Current cost is $-1.#J And your Profit is $-1.#J The stock is With Initial cost of $3390.55 Current cost is $3063.75 And your Profit is $-330.30 Press any key to continue . . .
His criticism isn't unwarranted. Tater is pointing out things in your code that are likely to cause an error and asking you to fix them. It could very well be the case that the problem resides in the use of these functions. If you're still getting those problems with everything else fixed, then it's at least narrowed down the possible causes quite a bit.
I'm not on a machine that has VS so I can't test it myself to see if any errors I get is consistent with yours, but look into the problem(s) and try to build on that.
As far as general logic goes, you also don't need to pass SIZE into each function. It's globally defined, so you can just increment your loops to SIZE without assigning an integer to it. Although it accomplished the same thing, I think it's a little more clear to somebody who's never seen the code before. There's some other things could be done differently, but overall I'd say the structure is pretty acceptable as an assignment. And check line line 113, there's a misspelling there (don't know if your teacher marks off for that stuff, but mine does so head's up).
Do you guys really think that gets() and all the stuff you told me about can break up the output?
Tater I didn't entitle you or anyone to anything. If you don't want to help, fine. I am just upset that you are simply criticizing my lack of knowledge without much help. You've told me what to look into, but you never clearly stated how to fix the problem. It all sort of "Try this, fix that", but how? Anyways, I'm going to ask my classmates and the teacher tomorrow in class.
Thanks for the help guys. I'll be sure to bring up all the issues you pointed out to my teacher.
In a word... "Yes". It is very likely the use of these known to be bad functions is part of your problem.
1) I and others have given you a ton of good advice that you *stupidly* chose to ignore.Tater I didn't entitle you or anyone to anything. If you don't want to help, fine. I am just upset that you are simply criticizing my lack of knowledge without much help. You've told me what to look into, but you never clearly stated how to fix the problem. It all sort of "Try this, fix that", but how? Anyways, I'm going to ask my classmates and the teacher tomorrow in class.
Thanks for the help guys. I'll be sure to bring up all the issues you pointed out to my teacher.
2) Nobody is criticising your lack of knowledge... only your complete unwillingness to learn.
3) If you're teacher is as stupid as you say... well, good luck with that. (Maybe you deserve eachother)
Last edited by CommonTater; 12-11-2011 at 04:58 PM.