Hello all I have to make a program that counts all the characters that are in a given text file I have no errors when I compile it. But when I run it it prompts and takes the name of my file but then ends. Here is my code.
#include <string>
#include <iostream>
#include"counterType.h"
#include <fstream>
#define MAX 1000
using namespace std;
void countchar(counterType intchar, ifstream& indata);
int main()
{
    ifstream indata;
    counterType intchar;
    cout << "What file would you like to read?" << endl;
    string filename = "empty"; 
    cin >> filename;
    indata.open(filename);
    return 0;
    countchar(intchar, indata);
    intchar.displayCounter();
}
void countchar(counterType intchar, ifstream& indata)
{   
    string x;
    indata >> x;
    while(!indata.eof()) {
        indata >> x;
        intchar.incrementCounter(); 
    }
}   
 
     
    