Menu driven C++ program for writing, reading a file and writing vowels in another file

#include<fstream.h>
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<ctype.h>
void main()
{
   clrscr();
   int n,choice, flag;
   fstream file1,file2;
   char str[256];
   char ch;
   do
   {
      clrscr();
      cout<<"\n---MENU---\n1.Write text to the first file"
   <<"\n2.Read text from first file\n3.Write vowels to the second file"
   <<"\n4.Display the second file\n5.Exit";
      cout<<"\nEnter your choice : ";
      cin>>choice;
      switch(choice)
      {
  case 1: file1.open("smp1.txt",ios::out);
   cout<<"\nEnter the text : ";
   gets(str);
   file1<<str;
   file1.close();
   cout<<"\nFile1 Created successfully";
   break;
  case 2: file1.open("smp1.txt",ios::in);
   while(file1)
   {
      file1.get(ch);
      cout<<ch;
   }
   file1.close();
   break;
  case 3: file1.open("smp1.txt",ios::in);
   file2.open("smp2.txt",ios::out);
   while(file1.eof()==0)
   {
      file1.get(ch);
      if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
         file2.put(ch);
   }
   file1.close();
   file2.close();
   cout<<"\nFile 2 is created with vowels from File 1";
   break;
  case 4: file2.open("smp2.txt",ios::in);
   cout<<"\nLower case vowels : ";
   flag=0;
   while(file2)
   {
      file2.get(ch);
      if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
      {
         cout<<ch;
         flag=1;
      }
   }
   if(flag==0)
      cout<<"\nNo lower case vowels";
   cout<<"\nUpper case vowels : ";
   flag=0;
   file2.close();
   file2.open("smp2.txt",ios::in);
   while(file2)
   {
      file2.get(ch);
      if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
         {
     cout<<ch;
     flag=1;
         }
   }
   if(flag==0)
      cout<<"\nNo upper case vowels";
   break;
  case 5: exit(0);
 default: cout<<"\nWrong choice!!!";
   break;
      }
      cout<<"\nPress any key to continue";
      getch();
     } while(1);
    }


23 comments:

  1. This blog is really great.This site is very helpful and informational : click here

    ReplyDelete
  2. Great blog.you put Good stuff.All the topics were explained briefly.so quickly understand for me.I am waiting for your next fantastic blog.Thanks for sharing.Any coures related details learn...

    Java Training in Bangalore|

    ReplyDelete
  3. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site"Devops Training in Chennai"

    ReplyDelete
  4. In the free version File hosterz, some features such as the parallel downloads or the download speed is only very limited use. But even with the free version you can upload files up to 2GB. The memory is unlimited here. In addition, the remote upload function can be used free of charge

    ReplyDelete
  5. The best place to learn C programming with an ease. Thanks for posting useful info...
    Best Online Software Training Institute | C++ Training

    ReplyDelete
  6. Informative blog ... Thnq for sharing your thoughts with us .. keep going..

    Selenium training | Selenium training in chennai

    ReplyDelete
  7. Great work. Quite a useful post, I learned some new points here.I wish you luck as you continue to follow that passion.
    Devops Training in Chennai | Devops Training Institute in Chennai

    ReplyDelete
  8. this teacher page having nice content..Great work. Quite a useful post, I learned some new points here.I wish you luck as you continue to follow that passion.keep update
    AngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery

    ReplyDelete
  9. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
    Salesforce Training in Chennai

    Salesforce Online Training in Chennai

    Salesforce Training in Bangalore

    Salesforce Training in Hyderabad

    Salesforce training in ameerpet

    Salesforce Training in Pune

    Salesforce Online Training

    Salesforce Training

    ReplyDelete
  10. Ucuz, kaliteli ve organik sosyal medya hizmetleri satın almak için Ravje Medyayı tercih edebilir ve sosyal medya hesaplarını hızla büyütebilirsin. Ravje Medya ile sosyal medya hesaplarını organik ve gerçek kişiler ile geliştirebilir, kişisel ya da ticari hesapların için Ravje Medyayı tercih edebilirsin. Ravje Medya internet sitesine giriş yapmak için hemen tıkla: ravje.com

    İnstagram takipçi satın almak için Ravje Medya hizmetlerini tercih edebilir, güvenilir ve gerçek takipçilere Ravje Medya ile ulaşabilirsin. İnstagram takipçi satın almak artık Ravje Medya ile oldukça güvenilir. Hemen instagram takipçi satın almak için Ravje Medyanın ilgili sayfasını ziyaret et: instagram takipçi satın al

    Tiktok takipçi satın al istiyorsan tercihini Ravje Medya yap! Ravje Medya uzman kadrosu ve profesyonel ekibi ile sizlere Tiktok takipçi satın alma hizmetide sunmaktadır. Tiktok takipçi satın almak için hemen tıkla: tiktok takipçi satın al

    İnstagram beğeni satın almak için Ravje medya instagram beğeni satın al sayfasına giriş yap, hızlı ve kaliteli instagram beğeni satın al: instagram beğeni satın al

    Youtube izlenme satın al sayfası ile hemen youtube izlenme satın al! Ravje medya kalitesi ile hemen youtube izlenme satın almak için tıklayın: youtube izlenme satın al

    Twitter takipçi satın almak istiyorsan Ravje medya twitter takipçi satın al sayfasına tıkla, Ravje medya güvencesi ile organik twitter takipçi satın al: twitter takipçi satın al

    ReplyDelete
  11. VT Markets Is A Forex Broker That Provides A Variety Of Competitive Trading Conditions, Like Low Minimum Deposit Demand, Tight Spreads, And Fast Trade Execution Speeds. Visit For More Information.

    ReplyDelete
  12. Excellent Submit, Very Informative. I’m Wondering Why VT Markets Opposite Specialists Of This Sector Don’t Realize This. You Should Continue Your Writing. I’m Confident, You Have A Great Readers’ Base Already!

    ReplyDelete
  13. The NoteZilla Crack is a highly functional calendar and task manager as well. Once you've organized them, they can be categorized.Notezilla Portable

    ReplyDelete
  14. Adobe Master Collection CC 2022 is a collection of applications from the Creative Cloud 2022 line and several junior version programs combined by a single .Adobe CC 2022 System Requirements

    ReplyDelete
  15. March 20, 2022 by Admin The wishes we have provided here for Christmas and new year are very new and are updated very recently.Formal Christmas Wishes

    ReplyDelete