GUI, matrix and vector libraries

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2006
Posts: 1
Reputation: the_glitch is an unknown quantity at this point 
Solved Threads: 0
the_glitch the_glitch is offline Offline
Newbie Poster

GUI, matrix and vector libraries

 
0
  #1
Apr 16th, 2007
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:
  1. #include <vector.h>
  2. ...
  3. vector<allocator_type> name(length);
But apparently not. And I thought that matrices were:
  1. #include <matrix.h>
  2. ...
  3. 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.)
Last edited by the_glitch; Apr 16th, 2007 at 9:51 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: GUI, matrix and vector libraries

 
0
  #2
Apr 16th, 2007
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:
  1. typedef vector<int> ROW_VEC ;
  2. vector< ROW_VEC > matrix ;
  3. int init_values[] = { 1,2,3,4,5,6,7,8,9 } ;
  4. ROW_VEC oneRow( init_values, init_values + 8 ) ;
  5. for( int i = 1; i<=9; i++ )
  6. {
  7. random_shuffle( oneRow.begin(), oneRow.end() ) ;
  8. matrix.push_back( oneRow ) ;
  9. }
  10.  
  11. for( i = 0; i<matrix.size(); i++ )
  12. {
  13. for( int j = 0; j<matrix[i].size(); j++ )
  14. cout << matrix[i][j] << '\t' ;
  15. cout << endl ;
  16. }

For pure C graphics use graphics.h.
For VC++ graphics you can use MS Flexi Grid (I donno what's DevC++)
Last edited by thekashyap; Apr 16th, 2007 at 10:48 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: GUI, matrix and vector libraries

 
0
  #3
Apr 16th, 2007
>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.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC