Lowyat.NET Forums

Welcome Guest ( Log In | Register )

LYN wins Intel-Lenovo-Tangs Blogathon challenge. Thank you everybody!
 
RSS feedBump TopicReply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> C++ help please, write a simple game

iceberg
post Jun 5 2006, 01:42 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #1


Newbie
*

Group: Junior Member
Posts: 13
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: May 2005





I want to write a game, it's like word guessing game. Suppose that secret word is "Pascal". Then the program would output "*****" at the beginning. the player guesses one letter in every move. Anybody can help me or give me advice or solution. Thanks
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dstl1128
post Jun 5 2006, 02:15 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #2


Look at all my stars!!
*******

Group: Senior Member
Posts: 3,606
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003




Google hangman.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
iceberg
post Jun 5 2006, 08:25 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #3


Newbie
*

Group: Junior Member
Posts: 13
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: May 2005





QUOTE(dstl1128 @ Jun 5 2006, 03:15 PM)
Google hangman.
*



ah? what's that? I wanna write with C++. Anybody can help me???
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
anthony_yio
post Jun 5 2006, 09:23 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #4


........
Group Icon
Codemasters

Group: Elite
Posts: 1,794
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003





QUOTE(iceberg @ Jun 5 2006, 08:25 PM)
ah? what's that? I wanna write with C++. Anybody can help me???
*


google "hangman+C+source code" get me this

http://www.planetsourcecode.com/vb/scripts...=10464&lngWId=3

Hangman is basically a word guessing game where game over when a man get hanged.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
sunsuron
post Jun 6 2006, 01:02 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #5


PHP Web Developer
*****

Group: Senior Member
Posts: 750
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Nov 2004






User is offlineProfile CardPM
Go to the top of the page
+Quote Post
SouthernAllStar
post Jun 15 2006, 03:54 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #6


Getting Started
**

Group: Junior Member
Posts: 53
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Mar 2006
From: Ampang "The place promised in our early days" :p





WTA: what is the diffrent between ms Visual C++ and borland C++, which is better?
(~_~; )

This post has been edited by SouthernAllStar: Jun 15 2006, 03:54 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
anthony_yio
post Jun 15 2006, 06:43 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #7


........
Group Icon
Codemasters

Group: Elite
Posts: 1,794
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003





QUOTE(SouthernAllStar @ Jun 15 2006, 03:54 PM)
WTA: what is the diffrent between ms Visual C++ and borland C++, which is better?
(~_~; )
*


Both are IDE with their own compiler. Borland uses VCL as interface components (Delphi UI lib too)for native app while Ms VC uses mainly MFC for native app.


It is like apple and orange. both are fruits.


User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dstl1128
post Jun 19 2006, 06:14 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #8


Look at all my stars!!
*******

Group: Senior Member
Posts: 3,606
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003




Extra:

Borland C++ last version is 5.02 which is many years ago.
Borland C++Builder 6 is Borland's 'last' C++ only tools (ok still can compile Delphi) for standard Windows app.
Borland C++BuilderX mainly for embeded or cross-platform app.
Borland Developer Studio is the latest one-stop gigantic development suite.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dopodplaya
post Jun 19 2006, 06:27 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #9


Look at all my stars!!
*******

Group: Senior Member
Posts: 2,088
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jun 2006





QUOTE(iceberg @ Jun 5 2006, 01:42 PM)
I want to write a game, it's like word guessing game. Suppose that secret word is "Pascal". Then the program would output "*****" at the beginning. the player guesses one letter in every move. Anybody can help me or give me advice or solution. Thanks
I give you the basic Idea la OK

int main ()
{
char guess;
char input[4] = {'p', 'i', 'g'};
for (int j = 1; j < 4; i++) cout<<"*";
cout<<endl;
cout<<"Guess a letter:";
cin<<guess;
for (int i =1; i < 4; i++)
{
//remember keep track of the correctly guessed letters
if (guess == input[i])
cout<<"the word with the letter reveal is";
else
cout<<"No such letter in word"
}
}

Then you fix it yourself, this one every general idea how to do your game... not even functioning... hehe.. Need to loop the input for user to guess every letter. Put your limit loop to max of you characters in the word you pick.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Bump TopicReply to this topicTopic OptionsStart new topic
 



----debug section please ignore----
Lo-Fi Version Time is now: 24th November 2009 - 03:11 PM
All Rights Reserved 2003-2009 Vijandren Ramadass (~living on a prayer~)