Member Avatar for sagar d

I have heard that games can be built using c language. I request someone to post the code for a simple game.(if possible,simple code too)..

Recommended Answers

All 13 Replies

It's true. You can build games using C. But you can build better using C++.
Object oriented design helps a lot when you model the game world, entities
and entity interactions. Plus, there are very good libraries available to help.

As for your code request, I guess there are a couple of things I can give you...

The first was my first attempt to write a console based snake game. I attach the cpp file.

The second was an attempt to seduce a girl with an advanced version of the above.
You can get it here -> http://www.4shared.com/file/NXIQiQFA/love_snake.html

I'd appreciate it if you didn't ask whether the attempt was successful or not.

I'd appreciate it if you didn't ask whether the attempt was successful or not.

Way to answer the question without it being asked. ;) If you'd rather not have someone ask, then clearly the attempt was unsuccessful.

...then clearly the attempt was unsuccessful.

Either that or that's what I want other people to believe.

Member Avatar for sagar d

thanks a lot guys:)

Member Avatar for sagar d

but if i copy the program in a note pad,how do i save it as a .cpp file so that i can open it using c?
n m really sry 4 u master roshi,wish u get a better gal next time:D

Member Avatar for sagar d

& Mr.platinum 8. there are quite a number of errors in the program... pls,can u fix them up & help.

commented: Fix them yourself if you want to steal code. -4

Uh, perhaps you'd like to share the code?

but if i copy the program in a note pad,how do i save it as a .cpp file so that i can open it using c?
n m really sry 4 u master roshi,wish u get a better gal next time

The standard file extension for C source files is .c, not .cpp.

If I may suggest ... C in a Nutshell from O'Reilly.

Member Avatar for sagar d

@imkj:the code is the same thats above... both the links(4shared & c.happycodings.com) have got errors(sadly,too many)...

@imkj:the code is the same thats above... both the links(4shared & c.happycodings.com) have got errors(sadly,too many)...

Then you should happily contact the author and ask them to rewrite it for you.

Then you should happily contact the author and ask them to rewrite it for you.

Or at least show some effort, and then, if you're still encountering errors, you can post the code in question. (The code generating errors, not the entire source file)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.