How do i create a simple game using c++??

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2002
Posts: 1,135
Reputation: samaru is just really nice samaru is just really nice samaru is just really nice samaru is just really nice 
Solved Threads: 6
Team Colleague
samaru's Avatar
samaru samaru is offline Offline
a.k.a inscissor

Re: How do i create a simple game using c++??

 
0
  #11
May 30th, 2004
Originally Posted by ze_viru$
I've just started learning c++,so i want to take any challenge concerning c++.My question is where do i start when drafting a game program.Please ppl help me out.
What type of game? The more complex your game is, the more you'll need to organize your code, so I highly recommend learning object oriented techniques. Please be a little more speficic on what you have in mind. The simplest game I can think of that you can create is a "Guess The Magic Number" Game where you generate a random number, go into an infinite loop, and break out of the loop when the user guesses the generated random number.
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 217
Reputation: marceta is an unknown quantity at this point 
Solved Threads: 0
marceta marceta is offline Offline
Posting Whiz in Training

Re: How do i create a simple game using c++??

 
0
  #12
May 31st, 2004
inscissor is right, start simple. I have made the guessing game, take a look at virus, it should help you


here is the simple guessing game!

  1. #include <cstdlib>
  2. #include <ctime>
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. {
  7. int randomnumber = 0;
  8. int userguess = 20;
  9. randomnumber = (rand()%10)+1;
  10. cout << "The random number has been generated! It is between 1 and 10! \n";
  11. do
  12. {
  13. cout << "Please enter your guess" << endl;
  14. cin >> userguess;
  15. }
  16. while (userguess != randomnumber);
  17. cout << "YAY \n";
  18. return 0;
  19. }

same thing but with voids
  1. #include <cstdlib>
  2. #include <ctime>
  3. #include <iostream>
  4. using namespace std;
  5. void guesser();
  6. int main()
  7. {
  8. guesser();
  9. return 0;
  10. }
  11. void guesser()
  12. {
  13. int randomnumber = 0;
  14. int userguess = 20;
  15. randomnumber = (rand()%10)+1;
  16. cout << "The random number has been generated! It is between 1 and 10! \n";
  17. do
  18. {
  19. cout << "Please enter your guess" << endl;
  20. cin >> userguess;
  21. }
  22. while (userguess != randomnumber);
  23. cout << "YAY \n";
  24. }
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: zennma is an unknown quantity at this point 
Solved Threads: 0
zennma zennma is offline Offline
Newbie Poster

How do i learn C++?

 
-1
  #13
Oct 28th, 2009
I have search almost all day. Can someone please post a link or something.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 131
Reputation: restrictment is on a distinguished road 
Solved Threads: 9
restrictment's Avatar
restrictment restrictment is offline Offline
Junior Poster
 
0
  #14
Oct 28th, 2009
My first game I wrote was an rpg(made it yesterday), so yes..I am new as well. As a matter of fact, I've only been learning c++ this month. Anyhow, make an RPG where you choose your character and battle enemies...it isn't as complicated as you would think.
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC