phorce 131 Posting Whiz in Training Featured Poster

Hey,

What you need to do is download and install the Ajax version of this calendar. Thus, will provide you to access the multi-user aspect you require. Then, you need to create a form that inputs the data into a database. Then, finally, creating an Admin page that will allow people to see calendars.

Hope this helps,

Let me know if you need any more help :)

phorce 131 Posting Whiz in Training Featured Poster

Ok.

I think I do, but can you make the following clear:

  • How are the user's identified? Do they sign in some how
  • Does the Adam see multiple calendars, or, just one calendar that has all of the people?
  • How are you handling the meals? For example, are they stored? If so, can the meals be in a drop-down?
phorce 131 Posting Whiz in Training Featured Poster

Hey,
Bold Text Here
Why are you repeating name in all of the fields you are trying to process?

 <label class="description" for="element_2">Username </label>
    <div>
            <input id="element_2" **name="element_2"** class="element text medium" type="text" **name="username"**
            maxlength="255" value="Hello World!"/>

Could be your problem. Only have one name, in this case "username" then the PHP will know which texfield to get data from.

phorce 131 Posting Whiz in Training Featured Poster

Ahh, I remember installing something simular to this, using Ajax and then I built my own form where users can then add their own dates etc..

http://arshaw.com/fullcalendar/

It's quite good :)

phorce 131 Posting Whiz in Training Featured Poster

Okay..

But how would you do it via realtime? How will you alert the user that they have another message?

I would start with something easier, something like a private messaging system (This will give you a rough idea of how to create something simular).

So I'm guessing your using cookies/sessions?

<?php

    // connection information
    // connection information

        $query = "SELECT * FROM chat WHERE to='{$_SESSION['user_id']}'";
        $result = mysql_query($query);
        if(mysql_affected_rows() >= 1)
        {
           while($row = mysql_fetch_array($result))
           {
              // Here you can display the actual message "gmail"
              // or create a link (like the previous post) that contains the message.

           }
         }else{
           echo 'No new messages';
         }
        }
   ?>

Hope this helps. Look into "polling"/"Sockets" if you want something realtime.

phorce 131 Posting Whiz in Training Featured Poster

Okay, it's really unclear what you want to do...

I'm guessing you want some kind of message board, is this correct?

If so, you'd need a page that has something like "chat.php?id={id}" and then select/post messages to the table depending on it's ID..

<?php
   // chat.php
   $id = $_GET['id'];

   // include mysql connection data

   // query the database:
      $query = "SELECT * FROM chat WHERE id='$id'";
      $result = mysql_query($query);
      if(mysql_affected_rows() >= 1)
      {
          // display the chat
      }else{
        echo 'There are currently no messages';
      }
   ?>

Something along those lines?

phorce 131 Posting Whiz in Training Featured Poster

Hello,

Are you trying to create these tables everytime you run the SQL query?

phorce 131 Posting Whiz in Training Featured Poster

Hey thanks for the reply.

Ahh, I was looking for a way to do it without including offsetX, offsetY (I know it sounds dumb) but they fustrate the hell out of me!

phorce 131 Posting Whiz in Training Featured Poster

1 2
3 4

Like that, because the matrix would have to be formed as it was orignally displayed.

:)

phorce 131 Posting Whiz in Training Featured Poster

Hey thanks for your reply! So yes, that's how I want it.

If the final matrix is this:

00
11

01
01

01
01

10
01

There are four blocks, and these four blocks now need to be placed inside a 1D vector but still maintaining the same order:

0 0 0 1
1 1 0 1
0 1 1 0
0 1 0 1

If that makes sense?

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Hey,

I'm doing a project and on the last little piece.

It involved taking 2 matrices, splitting them into blocks and then checking whether the blocks are simular or not. If the blocks wasn't simular, then swap them /or/ create a new Matrix that holds the values of the second matrix (the correct one).

I have done this, and, been left the right Matrix, but, it's in 2x2 blocks and I need it to be in 4x4 blocks that match the same as the second Matrix. For example:

(The blocks are stored in a vector of vectors)

Matrix2:
0 0 0 1
1 1 0 1
0 1 1 0
0 1 0 1

Final Output:
00
11
01
01
01
01
10
01

I was thinking something like this:

vector<double> formatMatrix(vector<double>& theMatrix)
{
    vector<double> newMatrix(4*4, 0);
    for(int i=0; (i < 4*4); i++)
    {
        newMatrix.push_back(theMatrix[i]);

    }
    return newMatrix;
}

I need it so the final matrix is a 1D vector.

Any ideas? Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I need to store the cooridants of a vector, for example:

If the vector was:

0 1 0 1 0
0 1 0 1 0
0 1 1 1 1
0 0 0 0 0

And this vector is then split into blocks, I need to store the the corridents so I can then use them later to put the vector back together. Now I have managed to get the calculation to calculate the corridents, I just don't know how I'd go about setting them as a 2D vector..

Here is the function that handles the corridents:

vector<double> subsetMatrix(const iniMatrix& theMatrix, int mat_row, int mat_col, int offsetX, int offsetY, int newRow, intnewCol)
{  
    iniMatrix newMatrix;

    for(int i=offsetY; (i < newRow); i++)
    {
        for(int j= offsetX; (j < newCol); j++)
        {
            newMatrix.push_back(theMatrix[i*mat_row+j]);
            // i*mat_row+j IS the corridents 
        } 
    }
    return newMatrix;
}

I have a 2D vector defined in the class, I just need a way of pushing to this vector and then retriving it.

phorce 131 Posting Whiz in Training Featured Poster

Ehh? I'm guessing you know the names of these users?

I would use sessions:

<?php

      // if sucsessfully signed in
      $_SESSION['username'] = $username;

      switch($_SESSION['username'])
      {
         case 'bob':
         // redirect for bob
         break;

         case 'harry':
         // redirect for harry
         break;

         default:
          // default redirect
      }
  ?>
phorce 131 Posting Whiz in Training Featured Poster

Hello,

I'm trying to split a matrix (512x512) into blocks of (16x16)..

Now I have managed to complete this for a small matrix (4x4) but when I try to implement it using the 512x512 it fails and doesn't produce enough blocks for the entire matrix. Here is the code on the small matrix:

#include <iostream>
#include <fstream>
#include <sstream>
#include <iterator>
#include <vector>

using namespace std;

typedef vector<double> Matrix;

void subMatrix(const Matrix& mat, int subRow, int subCol)
{
    Matrix subMatrix(subRow * subCol, 0);
    int offsetX = 0;
    int offsetY = 0;
    for(int q=0; (q < (4)); q++)
    {
        for(int i=0; (i < subRow); i++)
        {
            for(int j=0; (j < subCol); j++)
            {
                int row = offsetX + j;
                int col = offsetY + i;
                int sum = subRow+subCol;
                //cout << row+col*sum;

                subMatrix[i*subRow+j] = mat[row+col*sum];

                cout << subMatrix[i*subRow+j] << ' ';
            }
            cout << endl;
        }
        cout << endl << endl;
        offsetX = offsetX*subRow+subRow;
        if(offsetX > 2)
        {
            offsetX = 0;
            offsetY = offsetY*subCol+subCol;
        }

        cout << endl;
    }
    cout << endl;

    for(int i=0; (i < subRow); i++)
    {
        for(int j=0; (j < subCol); j++)
        {
            //cout << subMatrix[i*subRow+j] << ' ';
        }
    }

}

int main(int argc, char *argv[]) {

    string theFile = "matrix1.txt";
    vector<double> values(4*4, 0);
    vector<double> theData;
    ifstream file(theFile.c_str());
    if(!file.is_open())
    {
        cerr << "File cannot be open";
        return 0;
    }
    while(!file.eof())
    {
        copy(istream_iterator<double>(file), istream_iterator<double>(), back_inserter(theData));
    }

    values = theData;
    subMatrix(values, 2, 2);
}

And the code on the 512x512..

#include <iostream>
#include <fstream>
#include <sstream>
#include <iterator> …
phorce 131 Posting Whiz in Training Featured Poster

Hello,

I have a 512x512 matrix and I need to split it int 16x16 blocks..

How many blocks will I therefore produce?

I've tried 8 blocks of 16x16 but this does not look right when outputting the complete matrix..

Any ideas?

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Where are you storing the information?

phorce 131 Posting Whiz in Training Featured Poster

I don't even get an email... Awkward. Yes the email option is one of the reasons I use DaniWeb so much. Especially when you ask for help.. You don't want to be checking every 2 seconds / having to find the thread again incase someone has replied.

also... ALT + S doesn't work for me...

Suggestion: Can you make it posible that if someones posted a link, then it opens a new window because it's annoying when you lose the daniweb page..

phorce 131 Posting Whiz in Training Featured Poster

Solved it :) - I'm an idiot!

Thanks though

phorce 131 Posting Whiz in Training Featured Poster

Is it me, or, when someone used to reply to a private message OR when there's new activity in a thread you own/participated in.. You get an email?

phorce 131 Posting Whiz in Training Featured Poster

I kind of understand what you want to do..

Is the field a required field? In which, the user MUST enter the data for the email to send?

<?php

    if(!isset($_POST['address']))
    {
       // Create a body WITHOUT the data
       $body = "This is what the email will say without the data";
    }else{
       $data = $_POST['address'];
       $body = "This is what the email will say if there is data.. The data is: $data";
    }

    mail($EMAIL_ADDRESS, 'From: blahblah@blah.com', 'The title', $body);


?>

Something along those lines?

phorce 131 Posting Whiz in Training Featured Poster

Hey,

Thanks for your replies..

Basically, I'm trying to split a matrix into blocks..

0 1 0 1
1 1 0 0
1 0 0 0
0 0 0 0

M1 = {
0 1
1 1
}

M2 = {

0 1
0 0
}

M3 = {
1 0
0 0
}

M4 = {
0 0
0 0
}

now I have two variables:
offsetX = 0;
offsetY = 0;
and using a formular I can calculate and it works well
apart from the very last block.. Here is the sequence of numbers:

0145
2367
891213
26273031 (This is wrong)

This is the code so far:

  Matrix subMatrix(subRow * subCol, 0);
    int offsetX = 0;
    int offsetY = 0;
    for(int q=0; (q < (4)); q++)
    {
        for(int i=0; (i < subRow); i++)
        {
            for(int j=0; (j < subCol); j++)
            {
                int row = offsetX + j;
                int col = offsetY + i;
                int sum = subRow+subCol;
                cout << row+col*sum;

            }
        }
        offsetX = offsetX*3+2;
        cout << endl;
    }
    cout << endl;

Any ideas?? Thanks

phorce 131 Posting Whiz in Training Featured Poster

Hello,

Wondering if you can help me.. I have a variable, that each time needs to multiply by 2 (I know, it sounds simple.. I'm probably being an idiot) but it works like this:

LOOP 1
offsetX = 0;
offsetY = 0;

LOOP 2
offsetX = 2;
offsetY = 0
LOOP 3
offsetX = 4;
offsetY = 0;

Here is the code:

[code]

int offsetX = 0;
int offsetY = 0;
for(int i=0; (i < (4*4)); i++)
{
for(int i=0; (i < subRow); i++)
{
for(int j=0; (j < subCol); j++)
{
int var1 = offsetX + j;
int var2 = offsetY + i;

            row = offsetX*2;
            col= offsetY*2;

            cout << row << col << endl;
        }
    }

[/code]

Any ideas? Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I'm currently studying and sometime soon will have to do a final year project (which runs through the year)..
Now I've been looking at stuff om image recognition and although it interests me I want to do some kind of signals or signalling.

My idea is to capture the amount of energy that is coming from home devices, so for example, the amount of energy that is coming from your tv. I know that it will be a complex project to do, and I think it will require me to use some kind of Fourier (series) equation..

My question(s):

1) Is it possible to reach some kind of conclusion in a year?
2) Will it be incredibly difficult (From a mathematics prospective as well as a Programming)?

Any help will do :)

Thanks

phorce 131 Posting Whiz in Training Featured Poster

How woud that even work?

phorce 131 Posting Whiz in Training Featured Poster

Pardon?

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I have two paragraphs on my page and I need to draw a line between them. Now, I currently store the positions of the two paragraphs inside a database and I have access to them, I just don't know what to do from here. Some people have suggested I subtract certain values and then multiply.

Basically:

<p> 1:

position_x (top) : 38
position_x (left): 341

<p>2: 

position_x (top) :181
position_x (left): 597

Now to calculate the distance someone suggested something like this:

var algorith1 = $node1X - $node2Y;
var algorith2 = $node1Y - $node2X;

var final = $algorith1*$algorith2;

But then how would I draw a line? I'm not using canvass either, just jQuery/Javascript.

Anyone shed any help on this?

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

It produces an unreadable number "1.64643e-14" because the two numbers are too big?

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I have a major problem with a Correlation algorithm I'm trying to implement..

Basically, when I have two small matices:
Matrix 1:
0 1 0 1 1 1
1 1 1 1 1 1
0 1 0 0 0 1
1 1 0 0 0 0
1 1 1 1 1 1
0 0 0 0 0 0

Matrix2:
0 1 0 1 1 1
1 1 1 1 1 1
0 1 0 0 0 1
1 1 0 0 0 0
1 1 1 1 1 1
0 0 0 0 0 0

The result would be: 0.00142383

If I changed Matrix 2:

0 0 0 0 0 0
1 1 1 1 1 1
0 0 0 0 0 0
1 1 1 1 1 1
0 0 0 0 0 0
0 0 0 0 0 0

The result would be: 0.000263672

This is correct and works perfectly.. But I'm working on 2 512x512 matrices and when I try to find the Correlation it produces a number like: 1.64643e-14 which is obviously wrong.. I have tried everything.. Here is the algorithm I was given:

-Find the mean value of both matrices; subtract each element of
the matrices by its mean value
-For the numerator, multiply matrices element by element; take
the sum of the resultant …

phorce 131 Posting Whiz in Training Featured Poster

I was getting confused, I apologise..

Basically the cross-correlation between two matrices basically determines whether they are simular or not? If they are not simular then the swopping happens to make them simular..

One question regarding the cross-correlation: Can I do it on binary bits? Like find the mean etc..? Or do I have to convert the binary to the bit value (1, 2, 4, 8, 16 et..)?

phorce 131 Posting Whiz in Training Featured Poster

It's entirely possible to do this, but I'm not sure what it achieves. It's confusing, because it doesn't sound the same as the element-wise comparison you described first.

What I'm trying to achieve is by swopping by 32 x 32 blocks rather than single bits.. This will make it a lot more efficient kind of like this method:
- Find the mean value of both matrices; subtract each element of
the matrices by its mean value
- For the numerator, multiply matrices element by element; take
the sum of the resultant matrix after multiplication
- For the denominator,square each matrix element by element;
take the sum of each squared matrix; multiply the sum; square
the multiplied results
- Divide the numerator by the denominator
- The larger the similarity score, the more similar the matrices
are simular

If that makes more sense?

phorce 131 Posting Whiz in Training Featured Poster

Confused..

Do you need to design it? (Pseudocode) Or actually develop it?

phorce 131 Posting Whiz in Training Featured Poster

Hello thank you for your reply..

I have 2 matrices that are different but contain similarities. At the minute, I'm checking each individual bit and then swopping the values from matrix 2 to matrix 1 when they do not match. Doing this process bit by bit is timely.

I have been thinking and wanting to implementing an algorithm that swops the values by blocks of 32 x 32 because (512/16 = 32)... So in theory the process would work like this:

Run through the matrix1
Select a 32x32 block from matrix 1
Find the mean of this block
Select a 32x32 block from matrix2
Find the mean of this block
If the mean of both blocks do not match
Swop block2 to matrix1 [at the same position]
if the mean matchs, leave the block
end

Is this possible?

phorce 131 Posting Whiz in Training Featured Poster

Hello,

Thanks for the reply..

Have you heard of an FFT (Fast Fourier transform) it's this way I'm trying to implement. I know what you're suggesting but wouldn't it be a timely process? For example:

If I have:

Matrix 1:

0 1 1 1 1
0 1 0 1 0
0 1 0 1 0
1 1 1 0 1

Matrix 2:

0 0 0 0 0
1 1 0 1 0
1 1 0 1 0
1 1 1 0 0

Matrix 2 is the matrix that Matrix 1 needs to be..

First comparison:

0 1 1 -> 0 0 0
0 1 1 1 1 0

Then find the mean value..

0 1 1 -> 0 0 0
0 1 1 1 1 0

1 0

They do not match, swop them..

Something along those lines? =)

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I have 2 massive matrix's and I need to compare one matrix with another.. Now, I have come up with a solution that takes a 5x5 block of the matrix1 and compares it with a 5x5 block of matrix2, this happens until the end of both matrix's..

I'm confused to how I would select a 5x5 block of the two matrix. Here is the code:

for(int i=0; (i < 512); i++) // rows
    {
        for(int l=0; (l < 512); l++) // columns
        {
            for(int j=0; (j < 5); j++) // select 5 rows
            {
                for(int k=0; (k < 5); k++) // select 5 columns
                {
                    cout << matrix2[j*512+k] << ' ';
                }
                cout << endl;
            }
        }
    }

Does anyone have any ideas?

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Hello,

Thanks for the reply.

This code:

mod(X, Y, X) :- X < Y.
mod(X, Y, Z) :- plus(X1, Y, X),  mod(X1, Y, Z).

Would I need another predicate called Plus? Wouldn't that just a infinite loop (so to speak).

phorce 131 Posting Whiz in Training Featured Poster

Hello thanks for your reply.

Do you mean something like this:

checkNum(Num1, Num2) :-
    Num1 > Num2.

modulo(A, B, Result) :-

    Result is (A-B),
    checkNum(Result, B),

?
BEGIN

Result = A-B,
check to see if the result is more than be,
[CONFUSED WHAT TO DO HERE]
END

I think you have to put result back modulo, because it takes 5 from the result..

phorce 131 Posting Whiz in Training Featured Poster

Hello, I need some help please..

I need to write a recursive predicate in Prolog that subtracts two numbers until number 2 is higher than the result.

I have completed the logic in C++:

#include <iostream>

using namespace std;
int mod3(int a, int b)
{
	int intResult = a-b;

	if(intResult > b)
	{
		return mod3(intResult, b);
	}

	return intResult;
}
int main(int argc, char *argv[]) {
	
	cout << mod3(23, 5);
	
	return 0;
}

BUT putting it into Prolog is doing my brain in.. This is what I've got so far:

modulo(X, M, Y) :-

Y is (X-M),
(Y > M),
modulo(X, M, Y).

Could someone give me some help/pointers on what I'm doing wrong?

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Hey thank you for your reply :)

I'm using something simular to that.

Just out of interest though: Vectors OR arrays for image manipulation?

Personally I want to use Vectors and only really use arrays when needed.

phorce 131 Posting Whiz in Training Featured Poster

Hello I'm making an application that reads a series of values from a text file and then converts it to a bitmap image.

Currently, I'm using arrays, but, deciding on a particular length is annoying.

I have been reading a few tutorials and i've read a lot about using vectors, which, I am happy to do so. But my question is this:

Can I use a vector like this:

vector<pixel> myImage;

Each binary digit in the text file represents a pixel in the Bitmap image?

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

SORRY! Having a bad day (I feel stupid now hehe)

Thank you so much for your help :)

phorce 131 Posting Whiz in Training Featured Poster

Thanks for the reply.

It kind of needs to be an array, because the values in the .txt file are:

0 1 0 1 0 1
1 1 1 1 1 1

I read it in as a string, and then convert it to an int array..

phorce 131 Posting Whiz in Training Featured Poster

Hello,

In my class I have a method that basically does this:

- Reads in characters from text file (as a string)
- Converts the characters into an integer
- Stores the values into the integer

Here is the code:

bool Loader::Read(string theFile)
{
    strRepositry = theFile;
    string theData = "";
    int i = 0; 
    int* data2 = new int();
    
    if(!file_exists())
    {
        return false;
    }
    
    ifstream file(strRepositry.c_str());
    
    
    while(!file.eof())
    {
        file >> theData;
        
        istringstream convert(theData);
        cout << i << endl;
        convert >> data2[i++];
    }
    file.close();
    cout << data2[0];
    data = data2;
    

    return true;
}

Now this crashes, it's because I'm using i++ but why? And is there a way around it?

Really, really confused.

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Hello

I'm working on a project, and I have the following classes:

  • Loader - This loads the contents of the text file
  • Matrix - This processes the data that has been loaded

Now I'm using association, Loader -> Matrix

In my matrix class I have a method that calls the object of the loader:

bool Matrix::Load()
{    
    
    if(!loader.Read(file_location))
    {
        return false;
    }
    
    int* data = loader.getData();
    
    for(int i=0; (i < columns); i++)
    {
        for(int j=0; (j < rows); j++)
        {
            matrix[i*rows+j] = data[i*rows+j];
        }
    }    
    
    return true;
}

In my Matrix class I'm defining a new object of the Loader class:

Loader loader;

Everything is fine, it all works, right up until I initialise a new object in main of class Matrix, then it returns either a Bus error or a Segmentation fault: 11..

I haven't done Association in a long time, but, I think it's something to do with how I'm initialising the loader Object.

Anyone have any suggestions?

phorce 131 Posting Whiz in Training Featured Poster

Hi
why do not you get a open source matrix c++ library , and have him do all the job for you ???

some thing like, eigen, HASEM, Armadillo and so on.

hope it helps

Ahh, Hello.

I'm not allowed to use open source libraries (It's an assignment).. I'm making my own library though, hence, I'm not displaying anything in the class.

phorce 131 Posting Whiz in Training Featured Poster

All of the doubles. I'm trying to print this:

0, 1, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 0, 0, 1, 0, 0, 1, 1,
1, 0, 0, 0, 1, 1, 1, 0, 0, 0,
1, 1, 1, 0, 1, 0, 0, 0, 1, 1,
0, 0, 1, 1, 1, 1, 0, 0, 1, 1,
1, 0, 1, 0, 0, 0, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1

But without doing it in the class, just in main, so I need to return it as an array, and then two for loops to print it out :)

phorce 131 Posting Whiz in Training Featured Poster

Thanks :)

If I returned it as a pointer to a double though:

double matrix = image1.read(); // store the values of the pointers
    
cout << matrix[1]; // print the values

And the method:

double Matrix::read()
{
    return *matrix;
}

Throws an error: error: invalid types ‘double[int]’ for array subscript

Does double matrix have to be an array as well to allow for "matrix[0]" etc?

phorce 131 Posting Whiz in Training Featured Poster

>>I'm trying to display the contents of a matrix without using "cout" in my class

Huh?? How do you plan to display something without using either cout or printf()? one way to accomplish that in MS-Windows is to call WriteFile() instead of cout.

Sorry about the confusion..

I'm going to display it in the main, obviously. Just not in the class. I'll just return the array inside the class then I can build multiple mains (forms, console etc..)

You can return it as a string and then print the string outside of the method/class...

I know what you're suggesting, I just cannot see why it would be efficient to read the data as a double, and then convert it to a string? Could I still do my calculations on the /double/ ?

phorce 131 Posting Whiz in Training Featured Poster

Hello :)

(Too many questions about this)!

Basically, I'm trying to display the contents of a matrix without using "cout" in my class. (It's a bad method)

I've tried to return an array, but, that failed miserably.. So I've got a method in my class:

double Matrix::read(int theRow, int theColumn)
{
    return matrix[theRow*rows*theColumn];
}

(This basically returns the elements of matrix according to theRow, theColumn)

In order to display the complete matrix, I have to use this algorithm:

matrix[i*rows+j]

i = for loop
j = for loop
e.g.

void Matrix::displayMatrix()
{
    for (int i=0; i<columns; i++){
        for (int j=0; j<rows; j++){
           cout<< matrix[i*rows+j] << "\t";
        }
        cout<<"\n";
    }
    
}

Is there a way I can replicate this inside main.. Something like this:

for(int i=0; (i < columns); i++)
    {
        for(int j=0; (j < rows); j++)
        {
            cout << m.read(ALGORITHM) << "\t";
            
        }
        cout << endl;
        
    }

If that makes sense? Hope someone can help, it's been annoying me!

phorce 131 Posting Whiz in Training Featured Poster

What's the data type of Matrix?

Thanks for your reply :)

The matrix is a double.

phorce 131 Posting Whiz in Training Featured Poster

Hello..

I'm doing a project that involves searching/matching 2 matrix's. The basic idea:

Matrix 1:

0 1 0 1 0
1 0 1 0 1
1 1 1 0 1

Which will then be interpreted in memory as:

0 1 0 1 0 1 0 1 0 1 1 1 1 0 1

Matrix 2:

0 1 0 1 0
1 0 1 0 1

Which will then be interpreted in memory as:

0 1 0 1 0 1 0 1 0 1

Would a binary tree (search) be most efficient? I've come up with the idea of starting at the midpoint and in the array(matrix 2) and checking to see if it matches with the other array (matrix2) and if it does, go left until it returns false, and then go right to check if there's a match.

Any ideas? :)