#include<iostream.h>
int main()
{
int row1[10];
int col2[10];
int m,n,p,q;
cout<<"Enter the number of rows in matrix A"<<endl;
cin>>m;
cout<<"Enter the number of columns in matrix A"<<endl;
cin>>n;
cout<<"Enter the number of rows in matrix B"<<endl;
cin>>p;
cout<<"Enter the number of columns in matrix B"<<endl;
cin>>q;
if(n!=p)
{
int i=0;
cout<<"enter the rows of matrix1"<<endl;
for(i=0;i<=m;i++)
{
cin>>row1[i];
int *ptrow= &row1[0];
row1[i]= *(row1+i);
}
cout<<"enter the cols of matrix1"<<endl;
int k=0;
for(k=0;k<=;k++;)
{
cin>>row1[k];
int *ptcol2= &col2[0];
col2[k]= *(col2+k);
}
int matpro (int row1, int col2, int (*matpro)(int,int));
{
int pro[i][k];
for(i=0;i<m;i++;)
{
for(k=0;k<=q;q++)
{
pro[i][k]= row1[i] * col2[k];
int *ptpro= &pro[0];
pro[i][k] = *(pro+i);
pro++;
}
}
      cout << "[" << i << "][" << j << "]: " << pro[i][j];
return(pro[i][k]);
}
}
}

it is showing errors like

expected primary-expression before ‘;’ token
27: error: expected `)' before ‘;’ token
27: error: expected primary-expression before ‘)’ token
:27: error: expected `;' before ‘)’ token
:36: error: expected `)' before ‘;’ token
:36: error: expected primary-expression before ‘)’ token
:36: error: expected `;' before ‘)’ token
:48: error: expected `}' at end of input
:48: error: expected `}' at end of input
48: error: expected `}' at end of input

Recommended Answers

All 8 Replies

A) no code tags
B) this aint the C section.

Fixed. Check the rules.

This: for(k=0;k<=;k++;) Should be this: for(k=0;k<=;k++) ( no semicolon after k++)

Remove ';' at mathpro

int mathpro(int,int,int)
{
    // math operation
}

And here's another one, in the following snippet k stops when it is more than what? Or, if you prefer, complete the following if k is less than or equal to what:

for(k=0; k<= ; k++; )

I've modified the programlike this, but its still not working:What's probem with this function?

int matpro(int row1[i],int col2[k],int pro[i][k]);
pro[i][k]  += pro[i][k]+  (*matpro)(&row1[i],&col2[k]);
      cout << "[" << i << "][" << k << "] " << pro[i][k];
return(pro[i][k]);
void matpro(int row1, int col2, int (*matpro)(int &row1,int &col1));

The semicolon are removed, but errors exist in the function defintion.

Vahny, this is your last chance. I told you before to USE CODE TAGS.
Click "Member Rules" and its all explained in there

So what's the problems. Declare the method before using them..Example..

// CODE TAG
// [code] 
// your code here
// [/code]

void matpro(int,int,int);

void main()
{
   // call matpro
   matpro(1,2,3);
}

void matpro(int a,int b, int c)
{
   // implm. here  
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.