Показать сообщение отдельно

  #3  
Старый 06.10.2007, 13:21
Kaimi
Reservists Of Antichat - Level 6
Регистрация: 23.08.2007
Сообщений: 1,237
Провел на форуме:
18127311

Репутация: 1676


Отправить сообщение для Kaimi с помощью ICQ
По умолчанию

Так сойдет?:

Код:
#include <iostream.h>
#include <fstream.h>
#include <time.h>
#include <conio.h>
int main()
	{
	time_t t;
        int a=0,i=0;
        cout<<"Make your decision: 1 - write; 2 - read"<<endl;
        cin>>a;
        switch(a)
                {
	        case 1: {ofstream out("test.txt");
                        if(!out) { cout<<"Error"; return 1; }
	                out<<t;
	                out.close(); break;}
                case 2: {ifstream in("test.txt");
                        if(!in) { cout<<"Error"; return 1;}
                        in>>i;
                        in.close(); break;}
                }

        cout<<"Out: "<<t<<endl;;
        cout<<"In: "<<i<<endl;;
	getch();

	}
_Great_: Ему, вероятно, нужно было на Си...