Sign in to follow this  

Cant get my matrix to print correctly

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;"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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this