Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Hang Man

  1. #1
    Member
    Join Date
    Sep 2013
    Posts
    41
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Hang Man

    My program stops working after I input the first letter. Why??? It works fine in C++.

    void lines(string a, string aa[]){
     
    			for(int b=0;b<a.length();b++)
    				cout<<aa[b]<<setw(5);
     
    		}
    		void check(string word, string a[],string answer){
     
    			for(int i=0;i<word.length();i++)
    				if(answer.compare(word.substr(i,1))==0)
    					a[i]=answer;
    		}
    		void win(string word, string a[], bool &w1){
     
    			for(int j=0;j<word.length();j++){
     
    				if(a[j].compare(word.substr(j,1))==0)
    					w1=true;
    				else
    					w1=false;
     
    			}
     
     
    		}


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    6,290
    My Mood
    Mellow
    Thanks
    252
    Thanked 777 Times in 762 Posts

    Default Re: Hang Man

    Did you know this is a Java Programming forum? If so, ask for help with Java code, post Java code with any errors you're getting, provide specific details better than "stops working," and ask specific questions.

  3. #3
    Junior Member
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Hang Man

    In java cout is System.out.print(); and for input you may use java.util.Scanner

Similar Threads

  1. Replies: 0
    Last Post: January 22nd, 2011, 11:52 AM
  2. Read XML from Internet Hang
    By yupingliew in forum Java Networking
    Replies: 8
    Last Post: November 9th, 2009, 09:49 AM