Answer:
See Explaination
Step-by-step explanation:
Code below
#include<fstream>
#include<conio.h>
#include<iostream> //libraries required
using namespace std;
int main(){
ifstream fin("input.txt"); //reading the file from the computer
char character;
int alphabets=0;
int spaces=0,digits=0,pucntuations=0; //initializing the variables
while(fin){ //looping all the characters in the file
fin.get(character); //getting the character one at a time
if(isalpha(character)) // if the character is alphaber we increment the alphabet variable
alphabets++;
else if(character==' ') // if space
spaces++;
else if(isdigit(character)) // if digit
digits++;
else if(ispunct(character)) // if punctuation
pucntuations++;
}
cout<<"Number of Digits:"<<digits<<endl; //priting out the results
cout<<"Number of Spaces:"<<spaces<<endl;
cout<<"Number of Alphabets:"<<alphabets<<endl;
cout<<"Number of Pucntuations : "<<pucntuations<<endl;
return 0;
}