new

3
#include<iostream> #include<stdlib.h> #include<process.h> #include<conio.h> using namespace std; void main() { while(1) { system("cls"); char choice; cout<<"press 1 to play"<<endl; cout<<"press 2 to exit"<<endl; cin>>choice; switch(choice) { case '1': { int wrong=0; char x1[9]={"pakistan"}; char y1[9]={"--------"}; char z,a; int i; cout<<"press y to start the game"<<endl; cin>>a; while(a=='y') { cout<<"Enter the alphabets"<<endl; for(i=0;i<=9;i++) { cin>>z; for(int j=0;j<=8;j++) { if(z==x1[j]) y1[j]=z; else if(z!='p'&&z!='a'&&z!='k'&&z!='i'&&z!='s'&&z!='t'&&z! ='a'&&z!='n') { cout<<" wrong"<<endl; wrong=wrong+1; break;

Upload: bilal-muhammad

Post on 12-Apr-2017

39 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: New

#include<iostream>#include<stdlib.h>#include<process.h>#include<conio.h>using namespace std;void main(){

while(1){

system("cls");char choice;cout<<"press 1 to play"<<endl;cout<<"press 2 to exit"<<endl;cin>>choice;switch(choice){case '1':

{int wrong=0;char x1[9]={"pakistan"};char y1[9]={"--------"};char z,a;int i;cout<<"press y to start the game"<<endl;

cin>>a;while(a=='y'){

cout<<"Enter the alphabets"<<endl;for(i=0;i<=9;i++){

cin>>z;for(int j=0;j<=8;j++){

if(z==x1[j])

y1[j]=z;else

if(z!='p'&&z!='a'&&z!='k'&&z!='i'&&z!='s'&&z!='t'&&z!='a'&&z!='n')

{cout<<"

wrong"<<endl;wrong=wrong+1;

break;}

else;}if(wrong==3){

cout<<"you lost"<<endl;break;

}

Page 2: New

if(y1[0]==x1[0]&&y1[1]==x1[1]&&y1[2]==x1[2]&&y1[3]==x1[3]&&y1[4]==x1[4]&&y1[5]==x1[5]&&y1[6]==x1[6]&&y1[7]==x1[7])

{cout<<"you win"<<endl;break;

} cout<<y1<<endl;

}break;}

}}}

char x2[6]={"india"};char y2[6]={"-----"};char c;int q;cout<<"Enter the alphabets"<<endl;for(q=0;q<7;q++){

cin>>c;for(int r=0;r<=4;r++){

if(c==x2[r])

y2[r]=c;else

if(c!='i'&&c!='n'&&c!='d'&&c!='i'&&c!='a'){cout<<"

wrong ans"<<endl;break;

}

else;

}cout<<y2<<endl;}case '2':

{exit(0);break;

}

}