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 ..im 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;
infile.open("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;
do{
getline(infile,container); // stores lines in container
names[counter] = container;
counter = counter+1 ;
}while(counter<343);
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;
do{
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="";
compare=used;
string piece="";
piece=current_letter;
//cout<<piece;
}
if(used!=current_letter) //piece is string entire name. compare is correct letter on line
{
int misguess=1;
misguess=misguess+1;
}
if(misguess==1)
{
cout<<"print";
}
if(misguess==2)
{
cout<<"ok";
}
//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;
}