| | |
c++ program to find the product of two array of integers-clear errors?
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 3
Reputation:
Solved Threads: 0
C++ Syntax (Toggle Plain Text)
#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
C++ Syntax (Toggle Plain Text)
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 10:56 am.
•
•
Join Date: Nov 2008
Posts: 3
Reputation:
Solved Threads: 0
I've modified the programlike this, but its still not working:What's probem with this function?
C++ Syntax (Toggle Plain Text)
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 11:20 pm. Reason: add code tags
So what's the problems. Declare the method before using them..Example..
// CODE TAG //void matpro(int,int,int); void main() { // call matpro matpro(1,2,3); } void matpro(int a,int b, int c) { // implm. here }C++ Syntax (Toggle Plain Text)
// your code here //
![]() |
Other Threads in the C++ Forum
- Previous Thread: How set fullscreen under win 2000 pro(console)?
- Next Thread: hpp?
Views: 1073 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






