In my program i am having problems displaying how the blkanks and letters here is the coding...
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int lives=6;
int j,k;
int n=0;
char guess;
int i;
char yn;
char word[] = {};
do
{
cout<<"Player 1 please enter your word here:";
cin>>word;
cout<<"ok your word is "<<word<<" is this correct?(y/n)\n";
cin>>yn;
}
while (yn=='n');
system("CLS");
for (i=0;word!='{rss:Content}';i++)
{
n++;
}
cout<<n;
char wordguess[n];
for (i=0;wordguess!='{rss:Content}';i++)
wordguess='_';
system("PAUSE");
cout<<"\n";
for (j=0;j<=n;j++)
{
while (wordguess[j]!=word[j]&&lives>=1)
{
system("CLS");
k=0;
cout<<wordguess<<"\n";
if (lives==6)
cout<<" _________\n"
" | |\n"
" | |\n"
" |\n"
" |\n"
" |\n"
"_____|_____";
if (lives==5)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" |\n"
" |\n"
"_____|_____";
if (lives==4)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | |\n"
" |\n"
"_____|_____";
if (lives==3)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | /|\n"
" |\n"
"_____|_____";
if (lives==2)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | /|\\n"
" |\n"
"_____|_____";
if (lives==1)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | /|\\n"
" | /\n"
"_____|_____";
cout<<"\nthe word is "<<n<<" letters long.";
cout<<"\nTake your guess of a letter:";
cin>>guess;
for (i=0;word!='{rss:Content}';i++)
{
if (word==guess)
{
wordguess=guess;
k++;
}
}
if (k==0)
{
lives=lives-1;
}
}
}
system("CLS");
if (lives>=1)
{
cout<<"WINNER! The word was "<<word<<"\n";
}
else if (lives==0)
{
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | /|\\n"
" | / \\n"
"_____|_____\n";
cout<<"LOSER! The word was "<<word<<"\n";
}
system("PAUSE");
return EXIT_SUCCESS;
}
please help
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int lives=6;
int j,k;
int n=0;
char guess;
int i;
char yn;
char word[] = {};
do
{
cout<<"Player 1 please enter your word here:";
cin>>word;
cout<<"ok your word is "<<word<<" is this correct?(y/n)\n";
cin>>yn;
}
while (yn=='n');
system("CLS");
for (i=0;word!='{rss:Content}';i++)
{
n++;
}
cout<<n;
char wordguess[n];
for (i=0;wordguess!='{rss:Content}';i++)
wordguess='_';
system("PAUSE");
cout<<"\n";
for (j=0;j<=n;j++)
{
while (wordguess[j]!=word[j]&&lives>=1)
{
system("CLS");
k=0;
cout<<wordguess<<"\n";
if (lives==6)
cout<<" _________\n"
" | |\n"
" | |\n"
" |\n"
" |\n"
" |\n"
"_____|_____";
if (lives==5)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" |\n"
" |\n"
"_____|_____";
if (lives==4)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | |\n"
" |\n"
"_____|_____";
if (lives==3)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | /|\n"
" |\n"
"_____|_____";
if (lives==2)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | /|\\n"
" |\n"
"_____|_____";
if (lives==1)
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | /|\\n"
" | /\n"
"_____|_____";
cout<<"\nthe word is "<<n<<" letters long.";
cout<<"\nTake your guess of a letter:";
cin>>guess;
for (i=0;word!='{rss:Content}';i++)
{
if (word==guess)
{
wordguess=guess;
k++;
}
}
if (k==0)
{
lives=lives-1;
}
}
}
system("CLS");
if (lives>=1)
{
cout<<"WINNER! The word was "<<word<<"\n";
}
else if (lives==0)
{
cout<<" _________\n"
" | |\n"
" | |\n"
" | O\n"
" | /|\\n"
" | / \\n"
"_____|_____\n";
cout<<"LOSER! The word was "<<word<<"\n";
}
system("PAUSE");
return EXIT_SUCCESS;
}
please help