Click here to Skip to main content
15,897,273 members

Comments by Mwater07 (Top 6 by date)

Mwater07 20-Sep-17 13:14pm View    
Thank you. I have done the changes that you have suggested on the code, it works fine. But as you have stated, during initialization row and col arrays on generate_row_and_col function , I only initialize indexes with non zero elements, rest of them are not initialized. This is not causing any error in this program, but in terms of good programming practice,those indexes with 0 values are not initiated and the arrays will look like(garbage, garbage,7, garbage, 5, garbage, garbage....). Can we just limit the generate_row_and_col function, so We can only store non zero value indexes.
Thank you
Mwater07 20-Sep-17 9:05am View    
Deleted
I need to write a C++ program that compute the dot product of two given vectors. In these programs, in vectors A and B only nonzero elements are stored. Use array of structures to store non-zero elements.
int product=0; for (int i=0; i<=n; i++) product+=A[i]*B[i]

The following is an example:
Input n: 10
Enter nonzero elements in A
Index val
2 7
4 5
7 8
9 4
Enter nonzero elements in B
Index val
3 5
4 6
9 5
Mwater07 20-Sep-17 9:03am View    
Deleted
I need to write a C++ program that compute the dot product of two given vectors. In these programs, in vectors A and B only nonzero elements are stored. Use array of structures to store non-zero elements.
int product=0; for (int i=0; i<=n; i++) product+=A[i]*B[i]

The following is an example:
Input n: 10
Enter nonzero elements in A
Index val
2 7
4 5
7 8
9 4
Enter nonzero elements in B
Index val
3 5
4 6
9 5
Mwater07 16-Mar-17 13:39pm View    
Yes, it worked.
Thank you
Mwater07 16-Mar-17 13:38pm View    
What kind of debugger would you recommend?