10-7-2005, 03:06 PM | #41 |
Resident Penguin
|
RE: Re: RE: Re: RE: Re: C++ Help
main () isn't even a function... I thought you had to say int main(); which means it has to return an integer. Could be wrong about that.
|
10-7-2005, 03:10 PM | #42 |
FFR Player
|
RE: Re: RE: Re: RE: Re: C++ Help
You can do void main with some compliers only. But you did not specify a data type for main...what were you thinking? :P
__________________
Signature subject to change. THE ZERRRRRG. |
10-7-2005, 03:50 PM | #43 |
is against custom titles
|
RE: Re: RE: Re: RE: Re: C++ Help
I know from experience that the compiler Jurs is using will accept void main() and that you need a function type in front of it.
Also, chicken, I'm still not sure of thes, but I would have written the conditional lines like: if ((y==0) && (x==0) I do that just to be safe, but again, I'm not sure exactly which parentheses are actually necessary (although I'm rather certain the outside ones are. --Guido http://andy.mikee385.com |
10-7-2005, 05:56 PM | #44 |
lil j the bad b-word
|
RE: Re: RE: Re: RE: Re: C++ Help
Thank you guys <333 I finished.
I got an 83 though because my teacher hates me (from last year) and I finished a day later.
__________________
|
10-7-2005, 06:03 PM | #45 | |
FFR Player
|
Re: RE: Re: RE: Re: RE: Re: C++ Help
Quote:
if (y == 0 && x==0) { } The inside ones are not necessary. -----Soccr743----- |
|
10-8-2005, 09:16 AM | #46 |
Away from Computer
|
RE: Re: RE: Re: RE: Re: RE: Re: C++ Help
I've never used int main or void main and it worked with my compiler
eh whatever, I'll start using it now just to be safe.
__________________
|
10-8-2005, 09:43 AM | #47 |
FFR Player
|
RE: Re: RE: Re: RE: Re: RE: Re: C++ Help
Chickendude, saying "main() { }" is like saying "void main() { }".
-----Soccr743----- |
10-8-2005, 12:32 PM | #48 |
FFR Player
Join Date: Dec 2003
Location: At My House
Posts: 989
|
RE: Re: RE: Re: RE: Re: RE: Re: C++ Help
It is a good habit to use "int main() {}" because you can control where you want your program to end (unless of course you have some legitimate reason why you wouldn't want to control where you stop the program).
__________________
|
10-8-2005, 03:12 PM | #49 |
Away from Computer
|
RE: Re: RE: Re: RE: Re: RE: Re: C++ Help
wait, does a function automatically end when something is returned?
__________________
|
10-8-2005, 03:23 PM | #50 | |
FFR Player
Join Date: Dec 2003
Location: At My House
Posts: 989
|
Re: RE: Re: RE: Re: RE: Re: RE: Re: C++ Help
Quote:
__________________
|
|
11-14-2005, 07:05 PM | #51 |
FFR Player
Join Date: Nov 2005
Age: 34
Posts: 853
|
RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: C++ Help
I would have to say using int main() is a great habit to get into. And a lot of the nuances (I think that is a word) of the code have to do with the compiler. I use Microsoft Visual C++ .Net. Pretty good, but it doesn't seem to like string variables.
http://www.cpp-home.com/forum/index.php?c=2 This is a good forum to go to for all your coding help.
__________________
www.freerice.com |
11-14-2005, 07:23 PM | #52 | |
FFR Player
Join Date: Dec 2003
Location: At My House
Posts: 989
|
ad0gg is awesome!
Quote:
__________________
|
|
11-14-2005, 07:42 PM | #53 |
FFR Player
|
RE: ad0gg is awesome!
I didnt like the string class provided, so I built my own. Its not that hard and it is worth it. While you are at it, you should also do a List<type> class for a better array thing, Dictionary<keytype, valuetype> for a lookup. (Those latter classes use templating which is a useful thing to know).
-----Soccr743----- |
11-15-2005, 01:09 PM | #54 | ||
FFR Player
Join Date: Nov 2005
Age: 34
Posts: 853
|
Re: ad0gg is awesome!
Quote:
__________________
www.freerice.com |
||
11-20-2005, 04:17 PM | #55 | |
aka uAnimals
|
RE: C++ Help
You could probably do it easier, and much more graphically presentable if you do it in Flash... I could probably whip something up for you in about half an hour... But since I'm too lazy to read the posts... I'm sure someone did this for you already anyways...
__________________
Quote:
|
|
11-21-2005, 11:16 AM | #56 |
Fractals!
|
RE: C++ Help
I think the logic behind the int main() function where everything else goes is that the main function is supposed to return 0 if the program runs according to plan. More robust programs would include nonzero return values for the main program depending on where a certain kind of problem cropped up.
Getting back to the original question on page 1 (even though I know it's kind of a moot point), you could just enter the price of the item, declare the markup and tax variables as functions of the price of the item, then output the item's price, the markup, and the tax, then the final total by summing them. If my logic holds, you could even enter negative values for the markup to indicate that the item is discounted. And if the logic doesn't hold, at least it's a good test case. Edit: I'm pretty good with algorithms, but I suck at coding. <_< |
02-3-2006, 08:55 AM | #57 | |
Forum User
Join Date: May 2004
Posts: 378
|
RE: Re: RE: Re: RE: Re: RE: Re: C++ Help
Quote:
BTW by the time i read your responce, I should do my project. I don't have internet at home right now and I can't use the school's internet too often unless its for school work. right now, i have freetime... (which is rare here...) So if you do respond... I won't be able to read it for awhile... which really sucks... (I guess i'll come by later... bye.) |
|
02-10-2006, 07:39 PM | #58 |
FFR Player
Join Date: Feb 2006
Posts: 3
|
RE: Re: RE: Re: RE: Re: RE: Re: C++ Help
my high school has a C++ course and an AP Comp Science(Java) course and next year they are adding an honors java course to replace the C++ course, but my school is a magnet school for math,science,and technology so I guess thats why we have all that
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|