Showing posts with label Data File. Show all posts
Showing posts with label Data File. Show all posts

C++ Program To Count Number Of Alphabets In A File

How to write C++ Program To Count Number Of Alphabets In A File in C++ programming ?


C++ Program To Count Number Of Alphabets In A File Character Count from a File, File handling program to count number of characters in a file, Program to count number of characters in specified string in C++ C Program to count number of characters in the file Write a c program to count the number of character C Program to count no. of characters, lines, spaces & tabs, C Program to count number of characters in the file. In this program you can learn c file operations.
C++ Program To Count Number Of Alphabets In A File


Solution:
//Program to count number of alphabets in a file.
#include<fstream.h>
#include<conio.h>
#include<ctype.h>
void main()
{
clrscr();
int count=0;
char a;

ofstream ofile("file.txt");
ofile<<"abcde34fghi43jkl34m234nop2343252qrst34uvwxyz";
ofile.close();

ifstream ifile("file.txt");
while(!ifile.eof())
{
ifile.get(a);
if(isalpha(a))
count++;
}
cout<<count;
getch();
}

This C++ Program executes To Count Number Of Alphabets In A File in C++ programming.

C++ Program To Write Numbers 1 to 100 in a data file

How to write a C++ Program to write numbers one to hundred in a data file notes.txt in C++ Programming.


C++ Program to write numbers 1 to 100 in a data file notes.txt in C++ Programmin.
C++ Program to write numbers one to hundred in a data file notes.txt in C++ Programmin.


Solution:
//Program to write numbers one to hundred in a data file notes.txt
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
clrscr();

ofstream ofile("notes.txt");
for(int i=1;i<=100;i++)
ofile<<i<<" ";
ofile.close();

char a;
ifstream ifile("notes.txt");
while(!ifile.eof())
{
ifile.get(a);
cout<<a;
}
getch();
}

This C++ Program to write numbers one to hundred in a data file notes.txt in C++ Programming.