Did you save it or did it automatically save after entering the 3 lines? [And next time, try to put your code between code tags ([code][/code]).]
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Hello,
I used the pico editor to cut your text, and paste them into my RedHat 9 box. Then closed the editor, and it compiled just fine.
Maybe you are using vi and left something in there. Or Emacs left something. I dunno. Try cat division.c and see if you see any junk in the file.
I do think, however, it is poor program design on two occasions:
* You are using an integer for the division. per = (M+M+M) / 5 What happens if I enter in decimal numbers?
* You are asking for input on one line. Will the computer accept typo corrections? I would input them one line at a time, so that if I do typo, I can correct it without deleting too much. You also do not check to make sure I enter in 5 values. What happens if I only put in four?
(I have tested these conditions. You should too).
Enjoy!
Christian
kc0arf
Posting Virtuoso
1,937 posts since Mar 2004
Reputation Points: 121
Solved Threads: 57
Somewhere in the C compiler details it states that the code has to finish with a newline. Dev-Cpp's GNU compiler and some other compilers give a warning, not an error. Many IDEs put the new line in automatically.
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
Couldn't help but notice that unless there is some bug in daniweb.com this is most read thread I've seen so far.. ! 17,751 times.. :)
thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
Couldn't help but notice that unless there is some bug in daniweb.com this is most read thread I've seen so far.. ! 17,751 times.. :)
:cool: :sweat: you need to report that to Dani
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
:cool: :sweat: you need to report that to Dani
I donno where/how to tell her.. You're the moderator.. :) I understand you guys have some forums by yourselves..
thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
No, this is no bug. Considering that the thread was started way back in 2004 and this is the most common warning message one encounters when using a gcc or g++ compiler, coupled with the fact that Daniweb is highly Search Engine Optimized site, it doesn't come as a surprise to me. :-)
Look at some other threads which were started in 2003 and 2004 and you would surely find most of them having more than 10K views.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
This thread is 3 years old, so it might have been read that many times!
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
i feel like i have touched history.
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179