السلام عليكم
بسم الله الرحمن الرحيم
البرنامج مكتوب بواسطه المترجم الاكثر من رائع ++Dev C
تحياتى ..
بسم الله الرحمن الرحيم
البرنامج مكتوب بواسطه المترجم الاكثر من رائع ++Dev C
PHP كود :
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{
char check ;
string rline;
char toread[1000];
ifstream read ;
ofstream write ;
int x;
HH:
cout<<"If you wanna read text press 'R' , wanna write press 'W'\n\n";
check = getch();
switch (check)
{
case 'r':
read.open("ex.txt");
if ( read.is_open())
{
while ( read.good())
{
getline (read , rline);
cout << endl << rline << endl << endl ;
}
}
break ;
case 'w' :
cout<<"\nWrite Text to save \n\n";
cin.get(toread , 9999) ;
write.open("ex.txt");
write << toread ;
cout << "\nSaved ..\n\n";
write.close();
break ;
case 'R' :
read.open("ex.txt");
if ( read.is_open())
{
while ( read.good())
{
getline (read , rline);
cout << endl << rline << endl << endl ;
}
}
break ;
case 'W' :
cout<<"\nWrite Text to save \n\n";
cin >> toread ;
write.open("ex.txt");
write << toread ;
cout << "\nSaved ..\n\n";
default :
cout <<"Error ! , Please enter a valid value"\n\n";
goto HH;
}
system("PAUSE");
return EXIT_SUCCESS;
}