My Area
Register
Donate
Help
FAQ
About us
Links
Articles
Competitions
Interviews
About HHC.com DJs
T-shirts and merchandise
Profile
Register
Active Topics
Topic Stats
Members
Search
Bookmarks
Add event
Label search
Artist search
Release / Track search

Raver's online
 Total online 1357
 Radio listeners 177+
Email Us!
Username: Password:

  Lost password
 Remember my login 
 
 All forums
 General discussion
 

anybody know anything abou c/c++

 Printer friendly
 

All users can post new topics in this forum. All users can reply to topics in this forum

Author Thread  
CiALiN
Advanced Member



Ireland
535 posts
Joined: Apr, 2009
Posted - 2009/12/17 :  14:42:46  Show profile Send a private message
as the title says..i have a college project to do worth 50 % of the year...but i dont have a ****in notion how to do it

basically i have to write a word guessing game...where one player writes in a word to guess and the other has the same amount of guesses as the word lenght...if they get a letter wrong its game over.....

i seriously need some help..any would be great..


__________________________________
http://www.soundcloud.com/simpleton

http://www.myspace.com/sirsimpleton

http://www.youtube.com/cialino00o00o


Alert moderator
acidfluxxbass
Advanced Member



United Kingdom
5,000 posts
Joined: Apr, 2008
Posted - 2009/12/17 :  14:55:52  Show profile  Send a private message  Visit acidfluxxbass's homepage
I've used it a bit recently. total noob at it tho :)

__________________________________
Aka Archefluxx
Soundcloud: http://soundcloud.com/archefluxx
Youtube: http://www.youtube.com/user/afbofficial
Facebook: http://www.facebook.com/archefluxxuk




Alert moderator Go to top of page
CiALiN
Advanced Member



Ireland
535 posts
Joined: Apr, 2009
Posted - 2009/12/17 :  15:30:51  Show profile  Send a private message  Visit CiALiN's homepage
quote:
Originally posted by acidfluxxbass:
I've used it a bit recently. total noob at it tho :)



shite...im seriously ****ed...if i dont get this done...pretty ok then i have to repeat first year all over again


__________________________________
http://www.soundcloud.com/simpleton

http://www.myspace.com/sirsimpleton

http://www.youtube.com/cialino00o00o


Alert moderator Go to top of page
tru bass
Advanced Member



United Kingdom
1,996 posts
Joined: Jul, 2006
tru bass has attended 11 events
Posted - 2009/12/17 :  18:41:23  Show profile  Send a private message  Visit tru bass's homepage
quote:
Originally posted by CiALiN:
quote:
Originally posted by acidfluxxbass:
I've used it a bit recently. total noob at it tho :)



shite...im seriously ****ed...if i dont get this done...pretty ok then i have to repeat first year all over again



what are you doing it for? college or degree?

just wondering because i have to do it for my physics degree.. and is it hard?


__________________________________
http://soundcloud.com/shrubman


Alert moderator Go to top of page
Brian K
Advanced Member



United States
8,663 posts
Joined: Sep, 2001


528 hardcore releases
Brian K has attended 5 events
Posted - 2009/12/17 :  18:47:14  Show profile  Send a private message
sounds like you could write it using a bunch of if else statements

__________________________________
"we'll delete the weak"




Alert moderator Go to top of page
Project-Industrial
Advanced Member



Netherlands
2,481 posts
Joined: Nov, 2005


33 hardcore releases
Project-Industrial has attended 24 events
Posted - 2009/12/17 :  19:22:57  Show profile  Send a private message  Visit Project-Industrial's homepage
http://www.eastcoastgames.com/cpp/chapter4.html

that be the game u looking for ;)


been ages since i've done this stuff so just read that up.. not in the mood to explain how it works :p

just bcuz im an ass like that here's the whole code :D

quote:
// main4a.cpp
// This is the source to hangman by Forest J. Handford
// Copyright (c) 1998
//////////////////////////////////////////////////////

#include <iostream.h> // For input/output
#include <fstream.h> // For file input/output
#include <string.h> // For strcpy
#include <time.h> // For time
#include <stdlib.h> // For toupper and tolower

#define MAX_WORD_SIZE 15 // The max size for words
#define MAX_WORDS 255 // The max number of words

void LoadFile(); // Prototypes for our functions
void RunGame();
void DrawGallows(int State);


typedef char String[MAX_WORD_SIZE]; // Make a char type with 15 chars
String Words[MAX_WORDS - 1]; // This array will hold our words
int Count; //word count

// the main function of our hangman game
void main()
{
char Continue = 'Y'; // end game if = to 'N'
cout<<"Welcome to Hangman . . . Don't lose your head!"<<endl;

LoadFile(); // Load the data file

// Continue the game as longas the player wants
while(Continue == 'Y')
{
RunGame(); // Run the game
cout<<endl<<"Do you want to play again (Yes or No)? ";
cin>>Continue;
Continue = toupper(Continue);
}

// say good bye
cout<<endl<<"Thanks for playing."<<endl;
}

// This will load our file
void LoadFile()
{
char C; //Used to find EOF
ifstream Datfile; //The in file

Count=0; //Set count to 0

// Open the data file
Datfile.open("words.dat");

//Loop till the end of file
while((C=Datfile.peek()) != EOF)
{
// Get the next word and then increment Count
Datfile>>Words[Count++];

// If we surpass the max exit and tell the user
if(Count > MAX_WORDS - 1)
{
cout<<endl<<"Too many words in the file, stopping with "
<<MAX_WORDS<<" Words."<<endl;
Count = MAX_WORDS;
break;
}

}

// We need to subtract one to get the correct number of words
Count--;

// Close the data file
Datfile.close();

}

// This function will run the game
void RunGame()
{
int Word; // This will hold the subscript of our word
int Size; // This will hold the length of our word
int State=1; // This holds the game state
int Subscript=0; // This will hold subscripts
char Guess[MAX_WORD_SIZE]; // this will hold their current word
char Copy[MAX_WORD_SIZE]; // This will hold a copy of the word
char Letter; //This will be their letter guess
int Correct=0; // This is a True/False value deciding if they got a good answer

// Seed and create a random number
srand((unsigned)time( NULL )); // use time as a seed
Word = rand() % Count;

// Make a local copy of the word
strcpy(Copy,Words[Word]);

Size = strlen(Words[Word]); // Get the word's size

// Create a null terminated string to represent the word as the
// player knows it.
for(; Subscript < Size; Subscript++)
{
Guess[Subscript] = '-';
}

// insert the null charachter
Guess[Subscript] = '\0';

// Go till the player is hung
while(State!=6)
{
DrawGallows(State); //Draw the gallows
cout<<Guess<<endl; // Draw Guess

cout<<"Guess a letter :";
cin>>Letter;

// We will use only lower case letters
Letter = tolower(Letter);

// Loop through the word
for(Subscript = 0; Subscript < Size; Subscript++)
{

//if the guess is good tell the user and update Guess
if(Copy[Subscript] == Letter)
{
Guess[Subscript] = Letter;
Correct = 1;
cout<<endl<<"Good Guess!";

// If guess equals the word they won so exit
if(strcmp(Words[Word],Guess) == 0)
{
cout<<endl<<"Yea, You survived and won!";
return;
}
}
}

// If they didn't get aletter correct chide the user
if(Correct == 0)
{
cout<<endl<<"Sorry, bad guess!";
State++;
}

Correct = 0; // reset Correct

}

DrawGallows(State); //Draw the gallows at end of game
//They lost if they are here so tell them the answer.
cout<<"The word was : "<<Words[Word]<<endl<<endl;

}

// This will Draw the gallows according to the state
void DrawGallows(int State)
{
if(State==6)
{
// The \\ will translate as '\' because it is a special char
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | /|\\ "<<endl
<<" | / \\ "<<endl
<<" |Your Dead "<<endl
<<" ============"<<endl<<endl;
}
else if(State==5)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | /|\\ "<<endl
<<" | \\ "<<endl
<<" | "<<endl
<<" ============"<<endl<<endl;
}
else if(State==4)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | /|\\ "<<endl
<<" | "<<endl
<<" | "<<endl
<<" ============="<<endl<<endl;
}
else if(State==3)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | /| "<<endl
<<" | "<<endl
<<" | "<<endl
<<" ============="<<endl<<endl;
}
else if(State==2)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | | "<<endl
<<" | "<<endl
<<" | "<<endl
<<" ============="<<endl<<endl;
}
else if(State==1)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | "<<endl
<<" | "<<endl
<<" | "<<endl
<<" | "<<endl
<<" ============="<<endl<<endl;
}

}


__________________________________
Alias:
- Project Industrial
- Disease

http://www.project-industrial.com
http://www.discogs.com/label/Furious+Monkey+Records
http://www.furiousmonkeyrecords.com/


Alert moderator Go to top of page
Edited by - Project-Industrial on 2009/12/17 19:23:51
CiALiN
Advanced Member



Ireland
535 posts
Joined: Apr, 2009
Posted - 2009/12/17 :  20:19:47  Show profile  Send a private message  Visit CiALiN's homepage
quote:
Originally posted by tru bass:
quote:
Originally posted by CiALiN:
quote:
Originally posted by acidfluxxbass:
I've used it a bit recently. total noob at it tho :)



shite...im seriously ****ed...if i dont get this done...pretty ok then i have to repeat first year all over again



what are you doing it for? college or degree?

just wondering because i have to do it for my physics degree.. and is it hard?



well its like first year of my uni course...which is computer engineering..and i dunno i never went to class hence why im in trouble...but i wouldnt think so..seems pretty ok just wish id bothered to do more work


__________________________________
http://www.soundcloud.com/simpleton

http://www.myspace.com/sirsimpleton

http://www.youtube.com/cialino00o00o


Alert moderator Go to top of page
CiALiN
Advanced Member



Ireland
535 posts
Joined: Apr, 2009
Posted - 2009/12/17 :  20:25:19  Show profile  Send a private message  Visit CiALiN's homepage
legend man..thats pretty much it just more advanced...shall take a fair few bits from it :D

__________________________________
http://www.soundcloud.com/simpleton

http://www.myspace.com/sirsimpleton

http://www.youtube.com/cialino00o00o




Alert moderator Go to top of page
Project-Industrial
Advanced Member



Netherlands
2,481 posts
Joined: Nov, 2005


33 hardcore releases
Project-Industrial has attended 24 events
Posted - 2009/12/17 :  21:55:23  Show profile  Send a private message  Visit Project-Industrial's homepage
quote:
Originally posted by CiALiN:
legend man..thats pretty much it just more advanced...shall take a fair few bits from it :D



advanced :S thats as basic as it gets O.o its pretty much the first thing i learned lol :p
looks a damned lot like python aswell :) which can be linked quite easely to java/htm :) lotsa things possible with this stuff ^^


__________________________________
Alias:
- Project Industrial
- Disease

http://www.project-industrial.com
http://www.discogs.com/label/Furious+Monkey+Records
http://www.furiousmonkeyrecords.com/


Alert moderator Go to top of page
Edited by - Project-Industrial on 2009/12/17 21:56:39



New PostPost Reply
 Printer friendly
  Verified artist
   Donating member How to donate

It took 1.16 ninja's to process this page!

HappyHardcore.com

    

1999 - 2025 HappyHardcore.com
audio: PRS for music. Build: 3.1.73.1

Go to top of page