// 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&#40;"pause>nul"&#41;;
  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&#40;"pause>nul"&#41;;
 return 0;
}

Add a code snippet to your website: www.paste.org