the error is in these linesCode:// final.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <conio.h> using namespace std; int call_box(int a[8][8],int box){ if(box>=1&&box<=8){ int i=0; int j=box-1; return a[i][j];} if(box>=9&&box<=16){ int i=1; int j=box-9; return a[i][j];} if(box>=17&&box<=24){ int i=2; int j=box-17; return a[i][j]; } if(box>=25&&box<=32){ int i=3; int j=box-25; return a[i][j]; } if(box>=33&&box<=40){ int i=4; int j=box-33; return a[i][j]; } if(box>=41&&box<=48){ int i=5; int j=box-41; return a[i][j]; } if(box>49&&box<=56){ int i=6; int j=box-49; return a[i][j]; } if(box>=57&&box<=64){ int i=7; int j=box-57; return a[i][j]; } } int call_boxf(int l[8][8],int box){ if(box>=1&&box<=8){ int i=0; int j=box; return l[i][j];} if(box>=9&&box<=16){ int i=1; int j=box-9; return l[i][j];} if(box>=17&&box<=24){ int i=2; int j=box-17; return l[i][j]; } if(box>=25&&box<=32){ int i=3; int j=box-25; return l[i][j]; } if(box>=33&&box<=40){ int i=4; int j=box-33; return l[i][j]; } if(box>=41&&box<=48){ int i=5; int j=box-41; return l[i][j]; } if(box>49&&box<=56){ int i=6; int j=box-49; return l[i][j]; } if(box>=57&&box<=64){ int i=7; int j=box-57; return l[i][j]; } } int check_and_copy(int a[8][8],int l[8][8], int final[8][8]){ cout<<"enter the number of each square by pressing enter after each square number"; int box1; int box2; int count=0; int countg=0; while(count<32){ cin>>box1; cin>>box2; if(box1>=1&&box1<=64&&box2>=1&&box2<=64) call_box(a,box1); call_box(a,box2); if(call_box(a,box1)==call_box(a,box2)){ if(call_box(a,box1)!=call_boxf(final,box1)){ call_boxf(final,box1)=call_box(a,box1); call_boxf(final,box2)=call_box(a,box2); count++; cout<<"your answer is right enter another one";} else{cout<<"you already gave this answer";} }else{ cout<<"your answer is wrong try again";} else{ cout<<"you answer is out of bound try again";} for(int i=0;i<7;i++){ for(int j=0;j<7;j++){ cout<<l[i][j]<<" ";}cout<<endl;} cout<<countg;} return final[8][8];} void assign_half(int a[8][8],int r, int c){ for(int i=0;i<4;i++){ for(int j=0;j<8;j++){ a[i][j]=rand()%100; } } } void double_of_each(int a[8][8],int r,int c){ int maxr=4; for(int i=0;i<4;i++){ int maxc=7; for(int j=0;j<8;j++){ a[maxr][maxc]=a[i][j]; maxc--; } maxr++;} } int assignl(int l[8][8],int r,int c){ int f=1; for(int b=0;b<8;b++){ for(int c=0;c<8;c++){ l[b][c]=f; f++; }} return l[8][8]; } void disp(int l[8][8],int r,int c){ for(int i=0;i<r;i++){ for(int j=0;j<c;j++){ cout<<l[i][j]<<" "; } cout<<endl; } } int _tmain(int argc, _TCHAR* argv[]) { int a[8][8]={0}; int f[8][8]={0}; int l[8][8]={0}; int r=8; int c=8; assignl(l,r,c); disp(l,r,c); assign_half(a,r,c); double_of_each(a,r,c); check_and_copy(a,l,f); getch(); return 0; }
call_boxf(final,box1)=call_box(a,box1);
call_boxf(final,box2)=call_box(a,box2);
error C2106: '=' : left operand must be l-value



LinkBack URL
About LinkBacks



