Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 8 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Star Trek Voyager: Elite Force
Category: Star Trek Voyager: Elite Force General
General game questions, comments and chat.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Could anyone help me with a little C++?
Danne~rb
General Member
Since: Dec 23, 2006
Posts: 3233
Last: Dec 23, 2006
[view latest posts]
Level 9
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 09:23 am
I finally decided to start with a litte C++ programming, I'm currently working on my second program (the  first was the simple Hello World program)

Now to my question.
Is it possible to use 'if' statements to create a option if a user types in a certain text?

Like if someone wrote 'Hello', it give the text 'Hey you!', All this works with numbers, but not with text. How should I write it? and EXPLAIN! have only worked with C++ for a few days.

Thanks in advance
D A (<-- going to be my new nick, everyone calls me that now)
Share |
U.S.S. Speed~rb
General Member
Since: Dec 23, 2006
Posts: 9936
Last: Dec 23, 2006
[view latest posts]
Level 10
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 09:34 am
Yeah. Easily possible. But dunno enough about C++.

I think you need to use "==" with a table, or something like that.
You need a table that can store caracters, then compare the value of the table with your "Hello"...
Share |
Danne~rb
General Member
Since: Dec 23, 2006
Posts: 3233
Last: Dec 23, 2006
[view latest posts]
Level 9
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 09:40 am
okay... how do I create a table? been look for tutorials, but not found anything about tables... will look again though...
Share |
mabman~rb
General Member
Since: Dec 23, 2006
Posts: 2424
Last: Dec 23, 2006
[view latest posts]
Level 8
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 03:14 pm
I think you're looking for the "case" operator. Eg, you can create a statement evaluating the input variable, and assign a 2nd variable to whatever you want based on the first variable.  Essentially with "case" you can create a table of possible inputs and associated variable assignments based on which one is entered.

I haven't used C++ much myself, but that sounds like what you're trying to do...  Lookup "case" :)
Share |
Corran Horn~rb
General Member
Since: Dec 23, 2006
Posts: 7712
Last: Dec 23, 2006
[view latest posts]
Level 10
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 03:18 pm
Boy, with programming knowledge you really have to use it to keep it in your mind.  Back in the day I'm sure I could have hooked you up.  Today, the best I can come up with is this useless post.

Sorry.
Share |
mabman~rb
General Member
Since: Dec 23, 2006
Posts: 2424
Last: Dec 23, 2006
[view latest posts]
Level 8
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 04:17 pm
Sorry, I missed the part that said "it works with numbers..."  - make sure you're declaring the variables as "char", and you may have to use quotes around the variable assignment.  Also be careful with "new line" characters (like \n), which can mess up a match from time to time...

It might be useful if you posted your code sample so we can actually see what it is you're trying to do.
Share |
Agent007~rb
General Member
Since: Dec 23, 2006
Posts: 27798
Last: Dec 23, 2006
[view latest posts]
Level 10
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 04:46 pm
Quote (Corran Horn @ April 19 2004, 10:18 am)
Boy, with humor you really have to use it to keep it in your mind.  Back in the day I'm sure I could have hooked you up.  Today, the best I can come up with is this useless post.

Sorry.

:s8:

*shakes head*

Anyway, I could've have told you how to do it in VB a few months ago... Forgot most of that, though.  Heh.
Share |
skinner~rb
General Member
Since: Dec 23, 2006
Posts: 1241
Last: Dec 23, 2006
[view latest posts]
Level 8
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 05:32 pm
you need to store the text in a variable, like bob then do

if(bob == "JIM")
{
dothis
}
else if(bob == "NOT-JIM"){
dothat
}else{
do the other}
Share |
Corran Horn~rb
General Member
Since: Dec 23, 2006
Posts: 7712
Last: Dec 23, 2006
[view latest posts]
Level 10
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 06:11 pm
Quote (Agent007 @ April 19 2004, 12:46 pm)
Quote (Corran Horn @ April 19 2004, 10:18 am)
Boy, with  programming knowledge you really have to use it to keep it in your mind.  Back in the day I'm sure I could have hooked you up.  Today, the best I can come up with is this useless post.

Sorry.

:s8:

*shakes head*

Anyway, I could've have told you how to do it in VB a few months ago... Forgot most of that, though.  I'm spending too much time using GPS to accurately map Hoshi's forehead.  Oh...almost forgot I'm also learning Japanese so I can be rejected by a whole new culture!  Heh.

So true, so true.
Share |
Agent007~rb
General Member
Since: Dec 23, 2006
Posts: 27798
Last: Dec 23, 2006
[view latest posts]
Level 10
Category: Star Trek Voyager: Elite Force General
Posted: Monday, Apr. 19, 2004 06:28 pm
Got me on the last part, but the first part's way off... I'm going to be using 3DStudio. :s8:
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Star Trek Voyager: Elite Force : Star Trek Voyager: Elite Force General

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»