Advertisement
Ermolaxe

Список(Основа)

May 19th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include "list.cpp"
  4.  
  5. ifstream fin("input.txt");
  6. ofstream fout("output.txt");
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.     List <int> list;
  13.     int value;
  14.     while (fin>>value)
  15.     {
  16.         list.Insert(list.GetLength()+1, value);
  17.     }
  18.     fout << "Исходный список:";
  19.     list.Print();
  20.     fout << endl;
  21.  
  22.     for (int i=1;i<list.GetLength()+1;i++)
  23.     {
  24.         if (list.Get(i)==list.Get(i+1))
  25.         {
  26.             list.Remove(i+1);
  27.         }
  28.     }
  29.  
  30.     fout << "Измененный список:";
  31.     list.Print();
  32.     fout << endl;
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement