RSS Forums RSS

c++ program to find the product of two array of integers-clear errors?

Please support our C++ advertiser: Programming Forums
Reply
Posts: 3
Reputation: vahny is an unknown quantity at this point 
Solved Threads: 0
vahny vahny is offline Offline
Newbie Poster

c++ program to find the product of two array of integers-clear errors?

  #1  
Nov 21st, 2008
#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
Last edited by jbennet : Nov 21st, 2008 at 9:56 am.
AddThis Social Bookmark Button
Reply With Quote  
Posts: 15,220
Reputation: jbennet is a glorious beacon of light jbennet is a glorious beacon of light jbennet is a glorious beacon of light jbennet is a glorious beacon of light jbennet is a glorious beacon of light jbennet is a glorious beacon of light 
Solved Threads: 455
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is online now Online
Moderator

Re: c++ program to find the product of two array of integers-clear errors?

  #2  
Nov 21st, 2008
A) no code tags
B) this aint the C section.

Fixed. Check the rules.
Master of puppets Im pulling your strings - blinded by me, you cant see a thing. Master! Master!

If i am helpful, please give me reputation points.
Reply With Quote  
Posts: 2,353
Reputation: niek_e has much to be proud of niek_e has much to be proud of niek_e has much to be proud of niek_e has much to be proud of niek_e has much to be proud of niek_e has much to be proud of niek_e has much to be proud of niek_e has much to be proud of niek_e has much to be proud of niek_e has much to be proud of 
Solved Threads: 256
Featured Poster
niek_e's Avatar
niek_e niek_e is offline Offline
Nearly a Posting Maven

Re: c++ program to find the product of two array of integers-clear errors?

  #3  
Nov 21st, 2008
This:
for(k=0;k<=;k++;)
Should be this:
for(k=0;k<=;k++) ( no semicolon after k++)
Want better/more replies to your questions? Wrap your code in [code] [/code] tags!
Reply With Quote  
Posts: 314
Reputation: cikara21 is an unknown quantity at this point 
Solved Threads: 61
cikara21's Avatar
cikara21 cikara21 is offline Offline
Posting Whiz

Re: c++ program to find the product of two array of integers-clear errors?

  #4  
Nov 21st, 2008
Remove ';' at mathpro
int mathpro(int,int,int)
{
    // math operation
}
.:-cikara21-:.
Reply With Quote  
Posts: 1,572
Reputation: Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all 
Solved Threads: 239
Lerner Lerner is offline Offline
Posting Virtuoso

Re: c++ program to find the product of two array of integers-clear errors?

  #5  
Nov 21st, 2008
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++; )
Last edited by Lerner : Nov 21st, 2008 at 12:52 pm.
Klatu Barada Nikto
Reply With Quote  
Posts: 3
Reputation: vahny is an unknown quantity at this point 
Solved Threads: 0
vahny vahny is offline Offline
Newbie Poster

Re: c++ program to find the product of two array of integers-clear errors?

  #6  
Nov 21st, 2008
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));
Last edited by Ancient Dragon : Nov 21st, 2008 at 10:20 pm. Reason: add code tags
Reply With Quote  
Posts: 3
Reputation: vahny is an unknown quantity at this point 
Solved Threads: 0
vahny vahny is offline Offline
Newbie Poster

Re: c++ program to find the product of two array of integers-clear errors?

  #7  
Nov 21st, 2008
The semicolon are removed, but errors exist in the function defintion.
Reply With Quote  
Posts: 15,220
Reputation: jbennet is a glorious beacon of light jbennet is a glorious beacon of light jbennet is a glorious beacon of light jbennet is a glorious beacon of light jbennet is a glorious beacon of light jbennet is a glorious beacon of light 
Solved Threads: 455
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is online now Online
Moderator

Re: c++ program to find the product of two array of integers-clear errors?

  #8  
Nov 21st, 2008
Vahny, this is your last chance. I told you before to USE CODE TAGS.
Click "Member Rules" and its all explained in there
Master of puppets Im pulling your strings - blinded by me, you cant see a thing. Master! Master!

If i am helpful, please give me reputation points.
Reply With Quote  
Posts: 314
Reputation: cikara21 is an unknown quantity at this point 
Solved Threads: 61
cikara21's Avatar
cikara21 cikara21 is offline Offline
Posting Whiz

Re: c++ program to find the product of two array of integers-clear errors?

  #9  
Nov 22nd, 2008
So what's the problems. Declare the method before using them..Example..
// CODE TAG
//  
 
// your code here
// 
void matpro(int,int,int); void main() { // call matpro matpro(1,2,3); } void matpro(int a,int b, int c) { // implm. here }
.:-cikara21-:.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the C++ Forum
Views: 794 | Replies: 8 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 10:31 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC