C++ Program to Implement Bollywood Quiz Game
Here is the C++ Program to Implement Bollywood Quiz Game program As we know that we play this game in our childhood. So i think about this in converting into programming language. So i Made this in C++ ProgramSource Code
#include<iostream> #include<conio.h> #include<string.h> using namespace std; int main() { char a[50],b[50],ch,ca[50]; int count=9,c=0,i,e=0; cin>>a; cout<<a; system("cls"); for(i=0;i<strlen(a);i++) { if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u') { b[i]=a[i]; } else if(a[i]==' ') b[i]='!'; else b[i]='*'; } for(i=0;i<strlen(a);i++) { cout<<b[i]; } for(i=0;i<strlen(a);i++) { ca[i]=a[i]; } cout<<"\nenter character"; cin>>ch; while(count!=0 && e<strlen(a)) { if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u') { count--; } c=0,e=0; for(i=0;i<strlen(a);i++) { if(ca[i]==ch) { b[i]=ch; c++; ca[i]='0'; } } if(c==0) { count--; cout<<"\nWrong Character"; } else { for(i=0;i<strlen(a);i++) { cout<<b[i]; } } if(e==0) { for(i=0;i<strlen(a);i++) { if(a[i]==b[i] || (a[i]==' ' && b[i]=='!'))
{ e++; } } } if(e<strlen(a)) { cout<<"\n"<<count<<" chance remaining"; cout<<"\nEnter Another Character\n"; cin>>ch; } } if(e==strlen(a)) cout<<"\n!!!!YOU WIN!!!!"; else cout<<"\n!!!!U LOSE!!!!"; getch(); }
OUTPUT OF THE PROGRAM
0 comments:
Post a Comment