mardi 26 juillet 2016

could not identify what's wrong in this c++ program

i was tryig to run this code error in visual studio 2012

#include<iostream>
#include<fstream>
#include<stdio.h>
using namespace std;

void countalpha()
{
    ifstream fin("Story.txt",ios::in);
    char ch;
    int count=0;
    while (!fin.eof())
    {
        fin.get(ch);
        if(isalpha((unsigned char)ch)==0)
            count++;

    }
    cout<<"The number of alphabets is :";
    cout<<count;
    fin.close();
}

void main()
{
    cout<<"hellow world";
    countalpha();
    cout<<"this is end";

}

but on debugging the code, the console screen only shows the line hellow world and nothing happens after wards. could any one help?

Aucun commentaire:

Enregistrer un commentaire