Sign in to follow this  

Cant get my matrix to print correctly

This topic is 3101 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
Sign in to follow this