I need help with my code for computers, our final assignment is to make a simple game, so I decided to do Hangman. This assignment is worth 20% of my final mark due on Monday so if anybody could help me with it I would really appreciate it. (I'm still in high school and its just basic programming, so the code doesn't really need to be fancy as long as it works properly). The only thing I got to work were the lines, then everything else is just a huge mess. [ICODE] class hangMan { public static void main (String[] …

Member Avatar
Member Avatar
+0 forum 8

Hey everyone! So, I'm making a hangman game. I'm at the very beginning stages so I just have a String array and just to make sure it works correctly I want to print a random word from the array - simple, right? I am running into an error - the output is below. I would be so happy if you guys could help!!! here is the code - and yes Hangman2 is the correct name. import java.util.*; public class Hangman2 { public static void main(String [] args){ Random random = new Random(); int rgen = random.nextInt(10)+1; System.out.println(rgen); //print random to …

Member Avatar
Member Avatar
+0 forum 1

[CODE]public void takeGuess () throws IOException { temp=" "; Hangman obj = new Hangman(); System.out.println ("Enter a character or type in 'hint' for a hint!"); DataInputStream input=new DataInputStream(System.in); temp= input.readLine(); if (temp.length()==1) { guess=temp.charAt(0); if ((guess >= 'a' && guess <='z') || (guess >='A' && guess <='Z')) {System.out.println();} else {System.out.println ("Special symbols or numbers are not present in fruit names yet!" ); System.out.println ("Please give a correct input below"); obj.takeGuess();} } else if (temp.length()!=1) { if (temp=="hh") System.out.println ("giveHint()"); else {System.out.println ("Please give a correct single-character input below"); obj.takeGuess();} } System.out.println ( temp); System.out.println (guess); } [/CODE] I wrote this …

Member Avatar
Member Avatar
+0 forum 24

Here's my code for a Hangman game I'm developing: #include <iostream> using namespace std; const char *const Words[]={"America", "Barrack", "country", "doctors","salamat"}; #define NWORDS (sizeof Words/sizeof (char *)) int main() { const char *toguess=Words[0]; char guess[15] = " "; int numguesses = 1; char ch; string str1; string str2; // string mychars(""); unsigned wordno=1; std::cout << "Welcome to Hangman!\nRaymund is to be executed for a crime he committed.\nTo save him, you need to guess any of the five words provided by the judge.\nYou are given only 15 tries to solve any of the 5 words.\nGoodluck!\n\nNow enter a number to select the …

Member Avatar
+0 forum 0

Produce a complete C++ game that resembles the “Hang Man Game”, where the player is required to guess a given number/character/word. The player will be given a limited number of guesses. Each time the wrong answer is given, display an appropriate figure that changes accordingly. You may refer to the following diagrams as an example: 1st guess 2nd guess 3rd guess 4th guess Last/End Allow tips/hints to be given each time the guess is wrong. For example, tell the player that the mystery number is higher or lower than the wrong number given by the player or display the correct …

Member Avatar
Member Avatar
+0 forum 8

The End.