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);
    }


20 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. It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
    I’ve bookmarked your site, and I’m adding your RSS feeds to my Google account.
    java training in bangalore

    ReplyDelete
  5. I have to voice my passion for your kindness giving support to those
    people that should have guidance on this important matter.


    Selenium Training in Bangalore

    ReplyDelete
  6. Hey, I just want to ask, are you using word press for this website? It's super smooth and easy to use! By the way, if you need to register a business, let me know, I know the best business incorporation, register a business now!

    ReplyDelete
  7. 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
  8. On the one hand File hosterz, the free version, in which the functions such as download speed or parallel downloads are limited. On the other hand, the premium version, which is available in different terms. At the terms you can add depending on your desire traffic.

    ReplyDelete
  9. Appreciation for really being thoughtful and also for deciding on certain marvelous guides most people really want to be aware of.

    AWS Training in Chennai

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

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

    Selenium training | Selenium training in chennai

    ReplyDelete
  12. online stumbled upon online casino advertising, all kinds of slot machines And I was glad to click on the link to see such a cool design and everything is clear where and how to play and what to press merely online casino now this is my favorite site

    ReplyDelete
  13. Thanks Admin For sharing this massive info with us. it seems you have put more effort to write this blog , I gained more knowledge from your blog. Keep Doing..
    Regards,
    RPA Training in Chennai
    RPA Classes in Chennai
    CCNA Training in Chennai
    DevOps Training in Chennai
    SEO Training in Chennai
    RPA Training in OMR
    RPA Training in Velachery
    RPA Training in Tambaram

    ReplyDelete
  14. 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