Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-11-2005, 04:09 AM   #1 (permalink)
ands122
Registered User
 
Join Date: Jun 2005
Posts: 1
ands122 is on a distinguished road
C++ game script 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 and multiple compilations.



this is my code:


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.
ands122 is offline   Reply With Quote
Old 06-11-2005, 06:10 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,720
redhead is on a distinguished road
First off, if you plan on using C++, use correct C++ includes ie:
Code:
#include <stdio.h>
 #include <iostream.h>
 #include <string.h>
Is bad
Code:
#include <iostream>
 #include <string>
using std namespace;
is better

Another thing
Code:
string schoice;
...
                   switch(schoice1)
                   {
Switch only takes Intrinsic types So you'll have to change the way you're using teh switch here.

Else keep up the good work.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kaat a talking bot in c nvictor Platform/API C++ 10 05-19-2005 01:16 PM
Executing a server script from PHP sde PHP 4 02-05-2005 11:12 AM
running a script at designated time tzarin PHP 5 05-12-2004 07:11 PM
edit? anon Lounge 10 11-21-2002 03:02 PM


All times are GMT -8. The time now is 09:59 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting