You are on page 1of 1

/*

Assignment 03 : Program 15
Group : 02
Class: XII-F
Name : Aditya Mukherjee
*/
# include <conio.h>
# include <fstream.h>
# include <string.h>
# include <stdio.h>
# include <ctype.h>
void Intext(){
ofstream f("story.txt",ios::app);
char CH='\0'; char TXT[100];
do{
cout<<"Enter Text: "; gets(TXT);
f<<TXT<<endl;
cout<<"Do You Want to Continue ? (Y/N) "; cin>>CH;
}while(CH=='Y'||CH=='y');
f.close();
}
void Outtext(){
ifstream f("story.txt");
cout<<"The Contents of the file are: "<<endl;
char TXT[100];
while(!f.eof()){
f>>TXT;
cout<<TXT<<endl;
}
f.close();
}
void main(){
clrscr();
int CH=-1;
do{
cout<<"1. Enter Text"<<endl;
cout<<"2. Display Text"<<endl;
cout<<"3. Exit\n";
do{
cin>>CH;
}while(CH>3);
switch(CH){
case 1: Intext(); getch(); break;
case 2: Outtext(); getch(); break;
case 3: ;
}
}while(CH!=3);
getch();
}

You might also like