Sign in to follow this  

Improved Word Jumble!

This topic is 4114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok i got to the end of my chapter and they ask me to make a improved version of the game "Word Jumble" in this improved version they want me to add a scoring system.and they want the points to be based on the lenght of the word,and they want me to take points away when the person ask's for a 'Hint'. i know how to get the length of a word like the number of letters in it.But i sure how to do it. And i have spent alot of time now trying to figure out how i can do this and its really slowing me down right now.Yes i had alot of probs with this chapter lets just say i figured out what i dont like about programming "Arrays" lol.

Share this post


Link to post
Share on other sites
It could help us to help you if you told us which language you're using? I assume C since you're talking about strings in an array? then you can simply call strlen(). On a std::string there's the size() member function that will tell you how long the word is.

Cheers

Eric

Share this post


Link to post
Share on other sites
Quote:
Original post by DeathLetum
hehe my bad im kinda sleepy and hmm im using C++ and i didint really understand what you said in ur post


He says that if you loop over the array (or vector, whatever you use) you can get wordlength like this:

for(int i = 0; i < arrayLength; i++)
{
/// char* strings:
score += strlen(arrayWithWords[i]);
/// C++ strings:
score += arrayWithWords[i].size();
}


off course this is a very basic example ;)

Share this post


Link to post
Share on other sites
Hey,

I have no clue which book you're talking about or what's a "Word Jumble" game (maybe cause I'm French, heh)

If you give a little more details I might be able to help

Cheers

Eric

Share this post


Link to post
Share on other sites
yea i got that book a while ago and i stop programming for a while and now im picking it back up. So im now re-reading that book and im on ch.2 so im just 1 chapter behind ya. maybe when i catch up we can help each other on it.

Share this post


Link to post
Share on other sites

This topic is 4114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this