1. 1.
    +1
    #include<iostream>
    2. include<cstdlib>
    using namespace std;
    int main(){
    char word[30]="sandalye";
    char name[30];
    char x;
    int counter;
    cout<<"welcome to hangmann";
    cout<<"lets guess the wordn";
    for(int i=0;word[i]!='';i++){
    name[i]='*';
    }
    cout<<name;
    for(int j=0;j<=9;j++){
    cout<<"n";
    cout<<"enter a guessn";
    cin>>x;
    x=tolower(x);
    for(int i=0;word[i]!='';i++){
    if(word[i]==x)
    name[i]=word[i];
    }
    cout<<name;

    int counter=0;
    for(int k=0;word[k]!='';k++){
    if(name[k]!=word[k])
    counter++;}
    if(counter==0){
    cout<<"n";
    cout<<"congratulations you win";
    j=11;}

    }

    cout<<"n";
    cout<<"BYE BYE";
    cout<<"n";
    system("pause");
    return 0;
    }
    ···
   tümünü göster