0

Why cant i compile it?

#include<iostream.h> #include<conio.h> void main() { int A[10][10],B[10][10],C[10][10]; int ra,rb,ca,cb,r,c; cout<<"\n input row and column matrix A"; cin>>ra>>ca; cout<<"\n input row and column of matrix B"; cin>>rb>>cb; if ((ra==rb)&&(ca==cb)) { cout<<"\n input matrix A"; for(r=0;r<ra;r++) { for(c=0;c<ca;c++) { cin>>A[r][c]; } } cout<<"\n input matrix B"; for(r=0;r<ra;r++) { for(c=0;c<ca;c++) { cin>>B[r][c]; } } cout<<"\n matrix A+matrix B="; for(r=0;r<ra;r++) { for(c=0;c<ca;c++) { C[r][c]=A[r][c]+B[r][c]; cout<<' '<<C[r][c]; } cout<<endl; } } else cout<<"\n matrix is incompactible"; getch(); }

30th Jan 2019, 1:35 AM
Gokul
1 Réponse
+ 7
- #include <iostream> - add "using namespace std;" or "std::" every time you use cout etc. - change void main() to int main() and return 0 - remove getch() in Sololearn (will compile, but won't work)
30th Jan 2019, 3:25 AM
Anna
Anna - avatar