HEY guys,
I can't figure out why my code doesn't compile, I'm trying to read a text from a file, count the words. any help would be approciate it
thanks

#include<iostream>
 #include<fstream>
using namespace std;


//  global constants

const int MAX_ROW = 150 ;
const int MAX_COL = 80 ;
const int MAX_LEN = 25 ;
const char ENDLINE_CHAR = '\n';


void  getWords(char data [][MAX_COL], ifstream &fin );

bool uploadData(char data[MAX_LEN], char fileName []);
// Main Function/Program
 int main()


   {
    // initialize function


       // initialize variables

       char fileName[MAX_LEN] ;
       char data [MAX_LEN][MAX_COL];
       

       // display title
       cout << " Analyzing Shakespeare " << endl;
       cout << " ===================== " << endl;
       cout << endl;


      // get the file name 
      cout <<  " Enter name of file name : " ;
      cin>> fileName;
      cout<<endl;


       
 

        // upload the data from the file  and proccess it 
      
     uploadData( data, fileName);

    // shut down program

       // hold program for user view
       system( "pause" );

       // end program
       return 0;
   }

// functions implementation :
  

// open the file function 
 



 void  getWords( char words[][MAX_COL], ifstream &fin )
  {


 
 }

 bool uploadData(char words[MAX_LEN], char fileName [])
  {
  ifstream fin;

  int index = 0; 

 if(!uploadData( fileName, fin )
      { 
       cout<<" file name is invalid " <<endl;

       return false;
      }
 
  while( fin.good()) 
     {
    index++;
     }
 fin.getline(data[index];MAX_LEN; ENDLINE_CHAR)                                                                                                                                                                                                                                                                                                                                                                                                                                       ][], ENDLINE_CHAR );
 fin.close();
 return true;
   }

Recommended Answers

All 3 Replies

ravenrider,

Source program must be surrounded with BB code tags: See # icon at toolbar and also read How to use bb code tags?.

Member Avatar for jencas

Wanna win the "Perfect Endless Loop Trophy"?

while( fin.good())  
  {
      index++;
   }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.