[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

C++ Help with Matrices

Posted on 2014-04-13
9
Medium Priority
?
265 Views
Last Modified: 2014-04-13
Hi i need help multiplying 2 matrix arrays b_matrix and p_matrix such that it creates a V_matrix and then use that V_matrix to create the C_matrix.

This isnt necessarily 'matrix' multiplication, more so scalar, by that I mean i coded the formula such that the first row of the V_matrix will be 0 60 50 45.

Can anyone help me?
new-qap-ee-code-help.txt
0
Comment
Question by:college_student
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
9 Comments
 
LVL 36

Expert Comment

by:mccarl
ID: 39998245
The code that you've got there to do the multiplication looks fine. You just need to name the function properly (you can't have the square brackets in a function name) and then call that function from within your code. And I can't see how this would be too much of a drama because you have already done exactly this with the "costMatrix()" function!
0
 

Author Comment

by:college_student
ID: 39998249
how would i call it within the code? and would the proper name be V_matrix()?
0
 

Author Comment

by:college_student
ID: 39998265
ok ill keep that in mind. could you help answer my question though?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:Subrat (C++ windows/Linux)
ID: 39998276
I don't know while updating the message, i found some error related to {i} tag something....
So uploading the file for your reference.
Including to the above answer given by expert....

Look into the attachment.
help.txt
0
 
LVL 36

Accepted Solution

by:
mccarl earned 2000 total points
ID: 39998279
So I am assuming that you haven't written all this code yourself then?

Whoever wrote the "costMatrix()" function has given you a pretty good hint as to what to do. The code that you have posted shows how to declare a function, costMatrix, is an example of this, and also how to call that function from within other parts of your code (look at the fourth line of code in your main() function body. So all you need to do is follow those examples.

would the proper name be V_matrix()?
The proper name would be whatever you wanted to call it that makes sense to you. But yes, that is closer to the correct syntax to yuse when declaring the function. But I wouldn't call the function the same as an existing variable name. You may want to call the function something descriptive such as "calculateVMatrix()", although I am sure that as far as your algorithm goes, that there is probably an even better description for what generating the V matrix is really doing.
0
 

Author Closing Comment

by:college_student
ID: 39998295
Thanks for your help. i got it now
0
 
LVL 36

Expert Comment

by:mccarl
ID: 39998296
Not a problem! :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question