Jump to content
  • Advertisement
Sign in to follow this  
Yeshu

Cant get my matrix to print correctly

This topic is 3375 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

My matrix wont print correctly Im loading it from a dat file and all i get our empy spaces. Can anyone help? #include <iostream.h> #include "apmatrix.h" #include <fstream.h> #include<iomanip.h> int x; int y; char secret; apmatrix <char> matrix(6,6,0); int main() { ifstream infile; ifstream infile_alpha; infile.open("alpha.dat", ios::in); for(x=0;x<=5;x++) { for(y=0;y<=5;y++) { infile_alpha>>secret; matrix[x][y]=secret; } } cout<<setw(3); for(x=0;x<=5;x++) { for(y=0;y<=5;y++) { cout<<setw(3)<<matrix[x][y]; } } system("PAUSE"); return 0; }

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!