Hey Im having trouble building a hangman game and I cant get it to build here is my code if anyone can help

#include<conio>
#include<string>

using namespace std;
main(){    
	char word[30],getit[30],*found;
	int score,loop,len,num,lup,om,luptimes,times,fitimes,ondtimes,antimes;
	luptimes=0;
	fitimes=0;
	ondtimes=0;
	clrscr();
	printf("\n ENTER THE WORD: ");
	gets(word);
	score=0;
	num=0;
	om=0;
	len=strlen(word);
	clrscr();
	char gname[70];
	printf("\n ENTER YOUR NAME: ");
	scanf("%s",gname);
	char h;
	printf("\n LET's START: ");
	h='_';
	printf("\n LOOK HERE: ");
	for(loop=0;loop!=len;loop++)
	{
		printf("\n %c ",h);
	}    
	for(loop=0;loop!=len;loop++)    
	{        
		om=1;        
		num=num+1;        
		fitimes=0;        
		ondtimes=0;        
		printf("\n\n %d LETTER",num);        
		scanf("%s",&getit[num]);        
		found=strchr(word,getit[num]);        
		if(found)        
		{            
			for(luptimes=0;antimes=1;luptimes!=len;luptimes++,antimes++)            
			{                if(getit[num]==word[luptimes])                
			{                    
				fitimes++;                
			}                
			else                
			{                    
				fitimes=fitimes;                
			}            
			}           
			for(luptimes=num;luptimes!=0;luptimes--)            
			{                
				if(getit[num]==getit[luptimes])                
				{                    
					ondtimes++;                
				}                
				else                
				{                    
					ondtimes=ondtimes;                
				}            
			}            
			if(fitimes>=ondtimes)            
			{                
				score=score+1;                
				printf("\n OK\n");                
				for(lup=0;getit[num]!=word[lup];lup++)                
				{                    
					om++;                
				}                
				printf("\n POSITION: %d\n",om);                
				printf("\n ===================\n");            
			}            
			else            
			{                
				score=score;                
				printf("\n NOT AGAIN!\n");            
			}        
		}        
		else        
		{            
			score=score;            
			printf("\n NO\n");        
		}    
	}    
	printf("\n THE WORD IS '%s'\n"word);    
	printf("\n YOUR SCORE IS %d OUT OF %d",score,len);    
	getch(); 

	return 0;
}

If anyone can help that would be great thanks!!

Recommended Answers

All 3 Replies

Help with what? When asking for aid isn't it a good idea to describe the problem? We ain't the psychic programmers...

Help with what? When asking for aid isn't it a good idea to describe the problem? We ain't the psychic programmers...

sorry the problem is that i cannot get it to build i keep on getting on error message that says that #include<conio> is undefined

That's because conio is conio.h. And it's a C header, not C++, so you should remove it. Any functions you need from it are non-standard and should not be used.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.