Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
c++ code check this code 2011-12
#1
c++ code check this code 2011-12

There is a problem in this code check and solve this problem


Code:
#include<iostream.h> #include<conio.h> #include<stdlib.h> class bingo { public:int a[5][5]; void input(); void check(); void play(); void comp(); }; void bingo::input()//input a 5*5 matrix { int i,j,num; cout<<"\n Enter numbers 1-25\n"; for(i=0;i<5;i++) { for(j=0;j<5;j++) { cin>>a[i][j]; } endl; } } void bingo::check()//no number 1-25 must be repeated { int error=0; for(int i=0;i<5;i++) { for(int j=0;j<5;j++) { int num=a[i][j]; if(num==a[i][j+1]) { error=1; } } } if(error>0) { cout<<"\n Number repeated\n"; cout<<"PLEASE START OVER\n"; cout<<"\a"; getch(); exit(0); } } void bingo::play() { cout<<"\n START GAME\n"; for(int cal=1;cal<=25;cal++)//print input { for(int i=0;i<5;i++) { for(int j=0;j<5;j++) { cout<<a[i][j]<<" "; } cout<<"\n"<<"\n"; } cout<<"\n Enter the number to be striked\n"; int num,j,k=0,diag=0; cin>>num; for(i=0;i<5;i++)//place 0 in place of num { for(j=0;j<5;j++) { if(num==a[i][j]) { a[i][j]=0; if((a[k][k]==0)&&(diag!=5))//check for diagnol elements { diag++; k++; if(diag==5)//if all the 5 elents are 0 cout<<"\n Row completed\n"; } } } } } } void main() { clrscr(); bingo b; b.input(); b.check(); b.play(); }

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to check include library in Dev C++ Vuhelper 0 3,342 06-09-2012, 06:18 PM
Last Post: Vuhelper
  ASCII code is binary numbers of 0 and 1 in C++ 2012 Vuhelper 0 2,282 01-04-2012, 10:41 PM
Last Post: Vuhelper
  int x[10]; x[0]= 1; x[1]=2; if following code is executable in C++ 2012 Vuhelper 0 1,938 01-04-2012, 10:17 PM
Last Post: Vuhelper
  array project code c++ 2011 Vuhelper 0 1,282 12-10-2011, 06:32 PM
Last Post: Vuhelper
  factorial in C++ code 2011 Vuhelper 0 957 12-10-2011, 06:31 PM
Last Post: Vuhelper
  stack during function call in C++ 2011 Vuhelper 0 2,033 11-05-2011, 05:05 PM
Last Post: Vuhelper
  What is the Thing Queue? in c++ 2011 Vuhelper 0 1,787 11-05-2011, 05:02 PM
Last Post: Vuhelper
  ASCII to char conversion code in C++ 2011 Vuhelper 0 1,727 11-05-2011, 05:01 PM
Last Post: Vuhelper
  How to write a summation in a sequence? C++ 2011-12 Vuhelper 2 1,362 09-19-2011, 04:53 AM
Last Post: Xpert
  GetPixel problem in c++ 2011-12 Vuhelper 0 2,512 09-18-2011, 07:12 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)