Making a portfolio

Pages: 12
Visual Studio C++ 2008

File-> New-> Project-> Visual C++-> Win32-> Win32 Console Application -> "Enter a name for the Project" - Untick "Create Directory for Solution -> Click Ok -> Click Next -> Application Type[Console Application] -> Addition Options[Empty Project] -> Click Finish

In the solution explorer right click "Source Files" -> Add -> New Item -> Add a .cpp file -> Then paste my code into it and compile.

You should be able to do it something like this to. Other than that excellent.
yea I already got it but thanks anyways :)
Well hopefully if it helped let me know though what you thought of the comments I wrote for it on the site - Post it on the forums or my shoutbox on the main page. Just helps to let me know to see how I should write my tutorials as I only just started the site.

Enjoy :)
It's good :) it explains every part of the code except for the self-explanatory ones, wish I knew a bit more about programming... I seriously have to start from the beginning.
Awesome mate - as long as it helps. If you can see any improvements or something I can change layout wise - let me know :)

Thanks.
To get this working in Dev-C++ change the line void main() to int main() and just before the final closing curly brace add the lines:

1
2
getchar();
return 0;


:) very nicely made btw!
Last edited on
Thank you :)
Well 4am off to bed for me now. Any questions post them up with the tutorial and I'll answer them for you :) Enjoy and Goodnight heh
I have one comment to make based on something I read that you might want to consider changing.

quoted from: http://homepages.tesco.net/J.deBoynePollard/FGA/legality-of-void-main.html

You've come to this page because you've said something similar to

void main() is not legal in the C language. main() is required to return int.
This is the Frequently Given Answer to that false assertion.

The ISO C++ Standard (ISO/IEC 14882:1998) specifically requires main to return int. But the ISO C Standard (ISO/IEC 9899:1999) actually does not. This comes as a surprise to many people. But despite what many documents say, including the Usenet comp.lang.c FAQ document (at great length), the actual text of the C Standard allows for main returning other types.

In my opinion, this is a defect in the C Standard that needs fixing with a corrigendum. (I've written a proposed revised wording that such a corrigendum could use.) It provides the authors of bad C programming books with the very loophole that they have been needing for the past decade or so.

Nonetheless, this is what the C Standard says right now, and has said for several years, and those sections of the Usenet comp.lang.c FAQ document that state that void main() is disallowed are all completely wrong. In the event of a conflict such as this between the C Standard and the Usenet comp.lang.c FAQ document, the C Standard wins.


Just wanted you to be aware of that because your main() is of type void and i just thought I would share it. Would also like to know why you did that aswell? I mean I understand that its legal but wouldn't it be better practice?
Last edited on
Because for starting out programmers I don't see the point in teaching the arguments int main has. I'm just doing the most basic one so people can get the idea what to do :)
mcleano:
I mean I understand that its legal but wouldn't it be better practice?
Did you actually read your quote from that site? It specifically states that void main() is illegal in C++ since 1998.
@Mythios... Ah ok, fair enough. How nice of you lol :)

Did you actually read your quote from that site? It specifically states that void main() is illegal in C++ since 1998


Is the game not programmed in C though? I may be being ignorant here because C++ is my first programming language so I don't know the ins-and -uts of C, but what I do know makes me think that that program is C.
Yes - it's C.
Uh... Which file are we talking about, here? I thought it was Spaceinv.cpp.
Yes it is... but i've just seen that when you go download it it says, as you have written, Sapceinv.cpp. hmmm lol...

It's written in C but has a .cpp extension? Doesn't sound right Mythios.

Do you understand the point I was making though helios?
It's written as though it was C, but since it has a .cpp extension, it will be compiled by the C++ compiler. So it's doubly wrong.
Topic archived. No new replies allowed.
Pages: 12