Write a program that’s gets charaters from standard input device keyboard and puts into the file “sitd.txt” using get() and put() function


 

/* Write a program that’s gets charaters from standard input device keyboard and puts into the file “sitd.txt” using get() and put() function*/

#include<fstream.h>

#include<conio.h>

#include<process.h>

void main()

{

clrscr();

char ch;

ofstream out1(“sitd.txt”);

if(!out1)

{

cerr<<“file cannot open correctly”;

exit(-1);

}

cin.get(ch);

while(ch!=’\n’)

{

out1.put(ch);

cin.get(ch);

}

getch();

}

Related Posts

Comments are closed.