Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   i/o strems using 2 dimensional array (http://www.go4expert.com/forums/i-o-strems-using-2-dimensional-array-t16862/)

natasha23 10Apr2009 12:16

i/o strems using 2 dimensional array
Hay guys i am having a bit of trouble trying to code a two dimensional array that will respond to functions in a class when called from a main program.

i am reading in a file and i would like to display that file using a two dimensional array

although the code i have at the moment is creating a file for output but with nothing in it.

here is my code below:

#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
using std::ifstream;
using std::ofstream;
using std::endl;
using std::cout;

using namespace std;

class auditorium
              seats [14][30];
            void readSeatsConfig();
            void displaySeatsConfig();
            void getSeatClass();
void auditorium::readSeatsConfig(){
    ifstream infile;
    ofstream outfile;
    if (infile.fail())
      cout <<"file does not exist"<<endl;
        cout<<"Reading text file"<<endl;
void auditorium::displaySeatsConfig(char s[][30], int sizedimension1){
    ofstream outfile;
    for (int i1=0; i1 < sizedimension1; i1++){
        for (int i2; i2 < 30; i2++)
            outfile << s[i1][i2]<<endl;

if you could help that would be great

thanks in advance

All times are GMT +5.5. The time now is 17:35.