Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)
Paste
Pasted as C++ by Vaness ( 16 years ago )
// Deq1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
using namespace std;
// Приписать слева к исходному деку элементы другого дека, выбирая их слева
int _tmain(int argc, _TCHAR* argv[])
{
Deq a,b;
int t,t1;
FILE* f1 = fopen("input.txt", "r");
if (f1 == NULL)
{
cout<<"error at opening";
system("pause>nul");
return -1;
}
cout<<"Deq1: ";
fscanf(f1, "%d", &t);
for (int i=0; i<t; ++i)
{
fscanf(f1, "%d", &t1;);
a.Push_right(t1);
cout<<t1<<" ";
}
cout<<endl<<"Deq2: ";
fscanf(f1, "%d", &t);
for (int i=0; i<t; ++i)
{
fscanf(f1, "%d", &t1;);
b.Push_right(t1);
cout<<t1<<" ";
}
fclose(f1);
while (b.Pop_left(&t))
{
a.Push_left(t);
}
cout<<endl<<"Result: ";
while (a.Pop_left(&t))
{
cout<<t<<" ";
}
system("pause>nul");
return 0;
}
Revise this Paste