Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

BLurnewbie

How to write (square[Array()() - Array2()()]) as code?

This topic is 5724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Let me get this straight. You''re trying to square one array item from a 2d array minus another item in the 2d array, or all of the items in two sepeterate arrays or what?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
getting the sqaure of the difference

Share this post


Link to post
Share on other sites
square of the difference I understand. Of the entire 2d array, or two seperate 2d arrays of the same size or what?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
2 separate 2d array of the same size

Share this post


Link to post
Share on other sites
Ok, easy enough. We''ll say the arrays are 10x10, but they could be anything.

  
#include <math.h>

int arr1[10][10], arr2[10][10], int result;

// set the values somewhere to whatever


// I don''t know if you want to keep the values and add up a

// result or what, so I''ll just make a new result every time.


for(int i = 0; i < 10; i++)
for(int j = 0; j < 10; j++)
result = sqrt(arr1[i][j] - arr2[i][j]);


If you specify more what you need, I''d be happy to help.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I am trying to load a series of image files and compare it with an image file. After comparing, i should like to display the image file with the least square of difference (error)...

thanks

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!