Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

C++ program to count the characters tab vowels in a line from file

YASH PAL, 31 July 202422 August 2024

In this post we will write a C++ program to count the characters tab vowels in a line from file.

C++ program to count the characters tab vowels in a line from file

C++ program to count the characters tab vowels in a line from file.

#include<iostream>
#include<conio.h>
#include<process.h>
#include<fstream>
#include<string.h>
using namespace std;

int main()
{
    system("cls");

    int p = 0;
    int k = 0;
    int l = 0;
    int spcount = 0;
    int tabcount = 0;
    char ch;
    char arr[150];
    char str[] = "IF YOU WANT TO   ACCOMPLISH YOUR DREAM THEN WAKE UP";

    ofstream a("example.txt");

    int m = strlen(str);

    for(int j=0;j<m;j++)
    {
        a.put(str[j]);
    }

    a.close();

    ifstream b("example.txt");

    while(b)
    {
        b.get(ch);
        if(ch==' ')
        {
            p++;
        }
        if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U')
        {
            k++;
        }
        if(ch == ' ')
        {
            spcount++;
        }
        if(ch == 't')
        {
            tabcount++;
        }
        std::cout<<ch;
    }

    std::cout<<"n Number of spaces = "<<spcount;
    std::cout<<"n Number of characters = "<<m;
    std::cout<<"n Number of wovels = "<<k;
    std::cout<<"n Number of tabs = "<<tabcount;

    getch();
    return 0;
}

Output

IF YOU WANT TO ACCOMPLISH YOUR DREAM THEN WAKE UP
Number of spaces = 9
Number of charaacters = 50
Number of vowels = 16
Number of tabs = 1
C++ Programming Tutorials coding problems solutions

Post navigation

Previous post
Next post
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
How to download udemy paid courses for free

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
©2025 Programming101 | WordPress Theme by SuperbThemes