Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 10th, 2005, 08:54 PM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default small C++ game code PLEASE HELP!!!

 I have no experience with C++. this is my first program i've written. or at least tried to. I keep on getting this error.

Cannot specify -o with -c or -S an multiple compilations.



this is my code:



  #include <stdio.h>
  #include <iostream.h>
  #include <string.h>
  int main(int nNumberofArgs, char* pszArgs[])
  {
       //go to the market
       string smarket="go to the market";
       //explore
       string sexplore="explore";
       string schoice= ""
           cout << "You wake up from a sleep that you\n"
                << "can't remember... That's odd...\n"
                << "You find yourself next to a city.\n"
                << "You also see some money next to you.\n"
                << "Do you want to go to the market,\n"
                << "or explore? (type in either explore or go to market in exact words.)\n";
            cin >> schoice1;

                    switch(schoice1)
                    {
                            case smarket:
                      cout << "You walk into the market\n";
                            break;
                            case sexplore:
                      cout << "You explore. But of course,\n"
                      cout << "as you should've expected,\n"
                      cout << "you die. You don't know how,\n"
                      cout << "you just do.";
                            break;
                            default:
                      cout << "You didn't enter a valid command. Idiot.";
                     }
        return 0;
  }


by the way. I have C++ for dummies and i didn't even get half way through the book. I just want to make a simple game before I do. I don't know anything about the #include things or the return thing at the end. I was just wondering if anyone could help me.
Reply With Quote
  #2 (permalink)  
Old June 13th, 2005, 12:37 AM
Authorized User
 
Join Date: Mar 2005
Posts: 58
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Alan-LB Send a message via Yahoo to Alan-LB
Default

Perhaps you should read the WHOLE book - then read it again - then type in some of the examples and get them to run.

You cannot expect to get a program to run if you have not even read the textbook! Even to build a simple game you have to learn some basics! The "C++ for Dummies" is a reasonably good book to start from - maybe it is too advanced for you :-)

Programming is a fantastic occupation but it does need hard work, perseverance and intelligence!!

Alan


Reply With Quote
  #3 (permalink)  
Old June 18th, 2005, 04:55 PM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

actually I got it to work by changing the code a little - and I didn't read any farther in the book. :-) am I good or what ^_^
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with a small piece of code (New to VB) kwik10z Excel VBA 2 October 12th, 2007 06:46 AM
how do i get source code from online game? xzaverax Need help with your homework? 3 October 4th, 2007 12:57 PM
need C++ game programmers kumera C++ Programming 10 September 1st, 2007 11:54 AM
Pong Game Help -XM- BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 4 June 20th, 2007 02:23 PM
STRATEGIE - GAME! WarKrife C++ Programming 1 August 21st, 2003 08:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.