unable to display a file

I have to do a program that counts different types of characters in an ordinary text file. We are supposed to have the text file display in the output and I can't even get to that point. Here is what I have so far:

#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

//function prototypes go here



int main()
{
ifstream inputFile;

//Open the input file. If it fails to open, display an error message and
//end the program

inputFile.open( "compsci.txt" );
if( inputFile.fail() )
{
cout << "compsci.txt failed to open";
exit( -1 );
}

//******* The code to process the input file goes below this line *******

inputFile.open("compsci.txt");
char ch;
inputFile.get (ch);
ch++;
cout <<ch;



//Close the input file

inputFile.close();

cout<<endl;
system ("pause");
return 0;
}
Uh, so what isn't working?
Also, you need code tags on that.
it is not displaying the file in the output.
sorry my teacher doesn't require tags on everything so i'm not used to doing it.
No, it's not a programming thing, it's a forum thing.
http://www.cplusplus.com/articles/firedraco1/
Anyway, do you actually want to "increment" a character? Because that's exactly what you're doing, and it will change the character. In addition, you appear to be opening the file twice. That's really not going to go over well.
Do you mean have it output how many A's or B's(or any ascii char) are in the file?
I need to have it output how many characters are in the text, including whitespace, and I need to have the actual text within the file display in the output.
Topic archived. No new replies allowed.