someone please help me with printing out body parts...

read in word from list..user inputs letter.when correct letter is place on line..else stuck here..cannot print out body part when input is wrong..

#include <iostream> 
#include <fstream>
#include <iomanip>
#include <string>
#include <ctime>

using namespace std;

void pickword ();
int wordlength ();
void printout ();
void gameplay ();
void totalgames ();
void replay ();


int main()

	string guessed="";
	string scaffold_top="______"; 
    string scaffold_pole=" |";
	string scaffold_bottom="_|_____";
	string wrong;
	string names[350];
	ifstream infile;"smaller2.txt");
	int counter=0;
	int z;
	string container,at1,at2,at3,at4,at5,at6,at7,at8;
	char used;
	int misguess=0;
	char current_letter;

		getline(infile,container); // stores lines in container
		names[counter] = container;
		counter = counter+1 ;

	srand ( time(NULL) );
	z=rand()% counter;
	string right=names[z];
	string line[50];


cout<< endl << names[z] << endl ;  // this keeps track of what name is chosen

cout << names[z].length() << endl;

cout << "Please enter guessing letter."<<endl; 

for (int i =0; i<names[z].length(); i++) //prints out correct number of lines
	line[i] = '_';
	cout << line[i] <<" ";


//change the loop to a while/dowhile to check for when you guessed all the letters or lose.
//bool found = false;
	cin >> used; 
	for(int i=0;i<names[z].length();i++)
		 current_letter = names[z].at(i); 
		                                            //guesses correctly and places in line				
		if(current_letter==used)                                    // if used = any letter on line, we cout used on line and in used box
				line[i] = used;	
				string compare="";
                 string piece="";
		if(used!=current_letter)         //piece is string entire name. compare is correct letter on line
					int misguess=1;



			     //cout << guessed<<endl;	 
	guessed =guessed+used;

		for (int i =0; i<names[z].length(); i++)// prints remaining underscores after correct guesses
					cout<<line[i] <<" ";
	}while(guessed.length()<12);					//guess.length() is changing, names[z].length
                                            // is a constant..

return 0;
This article has been dead for over six months. Start a new discussion instead.