I originally joined this site almost a year ago so i could find out the name of the GUI library that's in most compilers. Didn't get much help back then.

But I hope that will change. I'm making a sudoku game in C++, so obviously I need a matrix (or a vector of vectors, if possible). Also, I could make it text-based, but I'd rather have some graphics. So, I need a matrix library, and a GUI library.

I thought that vectors were:

#include <vector.h>
...
vector<allocator_type> name(length);

But apparently not. And I thought that matrices were:

#include <matrix.h>
...
matrix<allocator_type> name(xDim,yDim);

But apparently my compiler doesn't even have the matrix library.

So could somebody help me out? In a nutshell, I'm having trouble with GUI, matrices, and vectors.

(By the way, I'm using Dev-C++ 5 on Windows XP.)

Not clear whether you have problems in declaring a 2D container or in showing a 2D container's data on a GUI?
If it's already been a year since you started on C++ I'm sure you know that a XxY matrix can be represented by:

typedef vector<int> ROW_VEC ;
    vector< ROW_VEC > matrix ;
    int init_values[] = { 1,2,3,4,5,6,7,8,9 } ;
    ROW_VEC oneRow( init_values, init_values + 8 ) ;
    for( int i = 1; i<=9; i++ )
    {
        random_shuffle( oneRow.begin(), oneRow.end() ) ;
        matrix.push_back( oneRow ) ;
    }

    for( i = 0; i<matrix.size(); i++ )
    {
        for( int j = 0; j<matrix[i].size(); j++ )
            cout << matrix[i][j] << '\t' ;
        cout << endl ;
    }

For pure C graphics use graphics.h.
For VC++ graphics you can use MS Flexi Grid (I donno what's DevC++)

Member Avatar for iamthwee

>I'm making a sudoku game in C++, so obviously I need a matrix (or a vector of vectors, if possible).

...yes a 2d array or variants of.

>Also, I could make it text-based, but I'd rather have some graphics.

If this is your first program then stick to text-based, GUI programming is slightly more involved.

> I thought that matrices were:
#include <matrix.h>

matrices, there is no such thing unless you are talking of the mathematical sense. You probably mean a 2d array.

>So could somebody help me out? In a nutshell, I'm having trouble with GUI, matrices, and vectors.

Yes start with a text based program, and work out your ideas on paper first.

>(By the way, I'm using Dev-C++ 5 on Windows XP.)
Dev has all the features necessary to make a win32 GUI application, but it is considered hard to pick up. For a more user friendly introduction into GUI programming your might want to check out c# or vb.net. But then you got to know OOP, so it is give and take.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.