0

please find what error in this program.while run it wont display the output

#include<iostream.h>
#include<fstream.h>
#include <stdio.h>
#include<conio.h>
#include <sys\stat.h>
class file
{
private:
int i;
int alphabet;
int space;
public:
void alphabets();
void spaces();
};
void file::alphabets()
{           alphabet=0;
fstream f;
char s;
f.open("NNEWFILE.TXT",ios::in|ios::app|ios::binary);
f.get(s);
while(s!=EOF )
{
if(i>63&&i<91||i>96&&i<123)
alphabet++;
}
printf("Number of alphabets%d\n",alphabet);
f.read((char *)this,sizeof(file));
f.close();
}
void file::spaces()
{
space=0;
fstream f;
char s;
f.open("NNEWFILE.TXT",ios::in|ios::app|ios::binary);
f.get(s);
while(s!=EOF )
{   if(s==' ')
    space++;
}
printf("Number of spaces%d\n",space);
f.read((char *)this,sizeof(file));
f.close();
}
void main()
{
file file;
int choice;
do
{
printf("1. No of lines:2. No of Words:");
scanf("%d",&choice);
switch(choice)
{
case 1:
file.alphabets();
break ;
case 2:
file.spaces();
default:
printf("invalid choice");
}
}while(choice!=3);
}

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by ravenous
0

You're probably going to need to do better than that to get a reasonable response. What is the code supposed to do? What is the actual problem? Are there compilation errors, does it crash with some error? Also, use code tags to make your code readable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.