Advertisement
Guest User

Untitled

a guest
Jul 1st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <tchar.h>
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <windows.h>
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     setlocale(LC_ALL, "Russian");
  11.  
  12.     unsigned int counter;
  13.     bool exit = false;
  14. loop:
  15.     while (!exit)
  16.     {
  17.         cout << "                                               .................#########...............=##=..... " << endl;                       Sleep(30);
  18.         cout << "                                               ................##########-............########... " << endl;                   Sleep(30);
  19.         cout << "                                               .................#########............@#########.. " << endl;                       Sleep(30);
  20.         cout << "                                               ......#.........:#####.................0########.. " << endl;                   Sleep(30);
  21.         cout << "                                               ....#:........###.........................#####... " << endl;                       Sleep(30);
  22.         cout << "    _|      _|                                 ..0#........*###.................................. " << endl;                       Sleep(30);
  23.         cout << "    _|_|  _|_|    _|_|    _|_|_|    _|    _|   .##........####+.................................. " << endl;                       Sleep(30);
  24.         cout << "    _|  _|  _|  _|_|_|_|  _|    _|  _|    _|   *#@.......=####................................... " << endl;                       Sleep(30);
  25.         cout << "    _|      _|  _|        _|    _|  _|    _|   ##........#####......+#####....................... " << endl;                       Sleep(30);
  26.         cout << "    _|      _|    _|_|_|  _|    _|    _|_|_|   ##.......-####@.....#######.......######.......#.. " << endl;                   Sleep(30);
  27.         cout << "                                               ##.......*#####.....######*......*#######......#.. " << endl;                       Sleep(30);
  28.         cout << "                                               ###.......#####0....#####..........######.....+#+. " << endl;                   Sleep(30);
  29.         cout << "     ______________                            ####......#######..................@####......###. " << endl;                       Sleep(30);
  30.         cout << "    |              |                           #####....##########.........................+####. " << endl;                       Sleep(30);
  31.         cout << "    |[1] Задачи    |                           ######...##############...######:.........######=. " << endl;                     Sleep(30);
  32.         cout << "    |              |                           ########.###############....@-....=#############.. " << endl;                       Sleep(30);
  33.         cout << "    |[2] Выход     |                           ##########################0####=@###############.. " << endl;                      Sleep(30);
  34.         cout << "    |______________|                           *###########################*:##################.. " << endl;                   Sleep(30);
  35.         cout << "                                               .#############################0..##############... " << endl;                       Sleep(30);
  36.         cout << "                                               .:###########################-...:############*... " << endl;                       Sleep(30);
  37.         cout << "                                               ..=##########.###############....:############.... " << endl;                       Sleep(30);
  38.         cout << "                                               ....#########..##############+...@###########..... " << endl;                       Sleep(30);
  39.         cout << "                                               ......#######...#############@...###########...... " << endl;                       Sleep(30);
  40.         cout << "                                               .................*############...##########...#..# " << endl;                       Sleep(30);
  41.         cout << "                                               ...................############..#######.......-.. " << endl;                       Sleep(30);
  42.         cout << "----------------------------------------------------------------------------------------------------------" << endl << endl << ">";
  43.         cin >> counter;
  44.         cout << endl;
  45.         switch (counter)
  46.         {
  47.         case 1:
  48.         {
  49.             cout << endl << "Выберите интересующую вас задачу в следующем меню." << endl << endl;                                 Sleep(30);
  50.             while (!exit)
  51.             {
  52.  
  53.                 cout << "_______________________|Задачи|_______________________" << endl;                                     Sleep(30);
  54.                 cout << "\n[1] Тема 'Разветвляющиеся алгоритмы'" << endl;                                                     Sleep(30);
  55.                 cout << "\n[2] Тема 'Массивы (динамическое выделение памяти)'" << endl;                                       Sleep(30);
  56.                 cout << "\n[3] Тема 'Функции  пользователя'" << endl;                                                         Sleep(30);
  57.                 cout << "\n[4] Задача №14" << endl;                                                                           Sleep(30);
  58.                 cout << "\n[5] Задача №15" << endl;                                                                           Sleep(30);
  59.                 cout << "\n[0] Вернуться в предыдущее меню" << endl << endl << ">";                                               Sleep(30);
  60.                 cin >> counter;
  61.                 cout << endl;
  62.                 switch (counter)
  63.                 {
  64.  
  65.                 case 1:
  66.                     cout << "Разветвляющиеся алгоритмы:" << endl;                                                 Sleep(30);
  67.                     cout << endl;
  68.                     cout << "Условие задачи:" << endl;                                                            Sleep(30);
  69.                     cout << endl;
  70.                     cout << "Запишите условный оператор, в котором значение переменной с" << endl;                Sleep(30);
  71.                     cout << "вычисдяется по формуле a+b,если а четное и a*b,если а - нечетное" << endl << endl;      Sleep(30);
  72.                     cout << "\n[1]Вывести листинг программы" << endl;                                               Sleep(30);
  73.                     cout << "\n[2]Запустить программу" << endl << endl << ">";                                          Sleep(30);
  74.                     cin >> counter;
  75.                     cout << endl;
  76.                     switch (counter)
  77.                     {
  78.                     case 1:
  79.                         cout << "#include <iostream>                                   " << endl;             Sleep(30);
  80.                         cout << "using namespace std;                                  " << endl;             Sleep(30);
  81.                         cout << "int main() {                                          " << endl;             Sleep(30);
  82.                         cout << "   setlocale(LC_ALL, "ru");                            "<< endl;             Sleep(30);
  83.                         cout << "   int a, b;                                            " << endl;             Sleep(30);
  84.                         cout << "   cout << "Введите число а : " << endl;                  " << endl;             Sleep(30);
  85.                         cout << "   cin >> a;                                            " << endl;             Sleep(30);
  86.                         cout << "   cout << "Введите число b : " << endl;                  " << endl;             Sleep(30);
  87.                         cout << "   cin >> b;                                            " << endl;             Sleep(30);
  88.                         cout << "   if (a % 2 == 0)                                      " << endl;             Sleep(30);
  89.                         cout << "   {                                                    " << endl;             Sleep(30);
  90.                         cout << "       cout << a + b << endl;                           " << endl;             Sleep(30);
  91.                         cout << "   }                                                    " << endl;             Sleep(30);
  92.                         cout << "   else                                                 " << endl;             Sleep(30);
  93.                         cout << "   {                                                    " << endl;             Sleep(30);
  94.                         cout << "       cout << a * b<< endl;                            " << endl;             Sleep(30);
  95.                         cout << "   }                                                    " << endl;             Sleep(30);
  96.                         cout << "}                                                     " << endl;             Sleep(30);
  97.                         break;
  98.                     case 2:
  99.                         ShellExecute(NULL, "open", "D:\\практика\\2\\Debug\\ConsoleApplication4.exe", NULL, NULL, SW_SHOWDEFAULT);
  100.                     }
  101.                     cout << endl;
  102.                     system("pause");
  103.                     cout << endl;
  104.                     break;
  105.  
  106.                 case 2:
  107.                     cout << "Массивы (динамическое выделение памяти)" << endl;                                    Sleep(30);
  108.                     cout << endl;
  109.                     cout << "Условие задачи:" << endl;                                                            Sleep(30);
  110.                     cout << endl;
  111.                     cout << "Ввести массив из n элементов и некоторое число P. " << endl;           Sleep(30);
  112.                     cout << "Заменить все,большие Р,элементы массива этим числом" << endl;           Sleep(30);
  113.                     cout << "Вычислить количество таких элемнтов.Если оно больше нуля,вывести преобразованный массив." << endl << endl;                       Sleep(30);
  114.                     cout << "\n[1]Вывести листинг программы" << endl;                                               Sleep(30);
  115.                     cout << "\n[2]Запустить программу" << endl << endl << ">";                                          Sleep(30);
  116.                     cin >> counter;
  117.                     cout << endl;
  118.                     switch (counter)
  119.                     {
  120.                     case 1:
  121.                         cout << "#include "stdafx.h"                                                                        " << endl;            Sleep(30);
  122.                         cout << "#include <iostream>                                                                        " << endl;            Sleep(30);
  123.                         cout << "#include <cstdlib>                                                                         " << endl;            Sleep(30);
  124.                         cout << "#include <ctime>                                                                           " << endl;            Sleep(30);
  125.                         cout << "using namespace std;                                                                       " << endl;            Sleep(30);
  126.                         cout << "                                                                                           " << endl;            Sleep(30);
  127.                         cout << "int main()                                                                                 " << endl;            Sleep(30);
  128.                         cout << "{                                                                                          " << endl;            Sleep(30);
  129.                         cout << "   int n, p, number;                                                                       " << endl;            Sleep(30);
  130.                         cout << "   number = 0;                                                                             " << endl;            Sleep(30);
  131.                         cout << "   cout << "Elements in array" << endl;                                                    " << endl;            Sleep(30);
  132.                         cout << "   cin >> n;                                                                               " << endl;            Sleep(30);
  133.                         cout << "   cout << "Num" << endl;                                                                  " << endl;            Sleep(30);
  134.                         cout << "   cin >> p;                                                                               " << endl;            Sleep(30);
  135.                         cout << "   int* a = new int[n];                                                                    " << endl;            Sleep(30);
  136.                         cout << "   srand(time(NULL));                                                                      " << endl;            Sleep(30);
  137.                         cout << "   for (int i = 0; i < n; i++)                                                             " << endl;            Sleep(30);
  138.                         cout << "   {                                                                                       " << endl;            Sleep(30);
  139.                         cout << "                                                                                           " << endl;            Sleep(30);
  140.                         cout << "       a[i] = 1 + (rand() % 100);;                                                         " << endl;            Sleep(30);
  141.                         cout <<
  142.                     }                                                                                       "<<endl;            Sleep(30);
  143.                         cout << "       for (int i = 0; i < n; i++)                                                         " << endl;            Sleep(30);
  144.                         cout << "   {                                                                                       " << endl;            Sleep(30);
  145.                         cout << "       if (a[i]>p)                                                                         " << endl;            Sleep(30);
  146.                         cout << "       {                                                                                   " << endl;            Sleep(30);
  147.                         cout << "           a[i] = p;                                                                       " << endl;            Sleep(30);
  148.                         cout << "           number++;                                                                       " << endl;            Sleep(30);
  149.                         cout << "       }                                                                                   " << endl;            Sleep(30);
  150.                         cout << "   }                                                                                       " << endl;            Sleep(30);
  151.                         cout << "                                                                                           " << endl;            Sleep(30);
  152.                         cout << "   cout << "Number of elements>" << p << " = " << number << endl << "--------" << endl;    " << endl;            Sleep(30);
  153.                         cout << "   if (number > 0)                                                                         " << endl;            Sleep(30);
  154.                         cout << "   {                                                                                       " << endl;            Sleep(30);
  155.                         cout << "       for (int i = 0; i < n; i++)                                                         " << endl;            Sleep(30);
  156.                         cout << "       {                                                                                   " << endl;            Sleep(30);
  157.                         cout << "           cout << a[i] << endl;                                                           " << endl;            Sleep(30);
  158.                         cout << "       }                                                                                   " << endl;            Sleep(30);
  159.                         cout << "   }                                                                                       " << endl;            Sleep(30);
  160.                         cout << "}                                                                                          " << endl;            Sleep(30);
  161.                         break;
  162.                 case 2:
  163.                     ShellExecute(NULL, "open", "D:\\практика\\14\\Debug\\ConsoleApplication5.exe", NULL, NULL, SW_SHOWDEFAULT);
  164.                 }
  165.                 cout << endl;
  166.                 system("pause");
  167.                 cout << endl;
  168.                 break;
  169.  
  170.         case 3:
  171.             cout << "Функции пользователя" << endl;                                                       Sleep(30);
  172.             cout << "                           " << endl;
  173.             cout << "Условие задачи:" << endl;                                                            Sleep(30);
  174.             cout << "                           " << endl;
  175.             cout << "Вычислить сумму факториалов всех нечетных чисел от m до n. " << endl;                Sleep(30);
  176.             cout << "Вычисление факториала оформить в функции." << endl << endl;                             Sleep(30);
  177.             cout << "\n[1]Вывести листинг программы" << endl;                                               Sleep(30);
  178.             cout << "\n[2]Запустить программу" << endl << endl << ">";                                          Sleep(30);
  179.             cin >> counter;
  180.             cout << endl;
  181.             switch (counter)
  182.             {
  183.             case 1:
  184.                 cout << "#include <iostream>                                        " << endl;        Sleep(30);
  185.                 cout << "#include <conio.h>                                         " << endl;        Sleep(30);
  186.                 cout << "                                                           " << endl;        Sleep(30);
  187.                 cout << "using namespace std;                                       " << endl;        Sleep(30);
  188.                 cout << "int fact(int N)                                            " << endl;        Sleep(30);
  189.                 cout << "{                                                          " << endl;        Sleep(30);
  190.                 cout << "   if (N < 0)                                                " << endl;        Sleep(30);
  191.                 cout << "       return 0;                                             " << endl;        Sleep(30);
  192.                 cout << "   if (N == 0)                                               " << endl;        Sleep(30);
  193.                 cout << "       return 1;                                             " << endl;        Sleep(30);
  194.                 cout << "   else                                                      " << endl;        Sleep(30);
  195.                 cout << "       return N * fact(N - 1);                               " << endl;        Sleep(30);
  196.                 cout << "}                                                          " << endl;        Sleep(30);
  197.                 cout << "int main()                                                 " << endl;        Sleep(30);
  198.                 cout << "{                                                          " << endl;        Sleep(30);
  199.                 cout << "   setlocale(LC_ALL, 'Russian');                             " << endl;        Sleep(30);
  200.                 cout << "   int m, n;                                                 " << endl;        Sleep(30);
  201.                 cout << "   cout<<'Введите длину массива'<<endl;                      " << endl;        Sleep(30);
  202.                 cout << "   cin>>n;                                                   " << endl;        Sleep(30);
  203.                 cout << "   cout<<'С какого элемента считать сумму '<<endl;           " << endl;        Sleep(30);
  204.                 cout << "   cout<<'факториалов нечетных чисел?'<<endl;                " << endl;        Sleep(30);
  205.                 cout << "   cin>>m;                                                   " << endl;        Sleep(30);
  206.                 cout << "   int *arr = new int[n];                                    " << endl;        Sleep(30);
  207.                 cout << "       for (int i = 0; i <= n; i++)                          " << endl;        Sleep(30);
  208.                 cout << "       {                                                     " << endl;        Sleep(30);
  209.                 cout << "           arr[i] = i + 1;                                   " << endl;        Sleep(30);
  210.                 cout << "       }                                                     " << endl;        Sleep(30);
  211.                 cout << "       int sum=0;                                            " << endl;        Sleep(30);
  212.                 cout << "       for (int i = 0; i <= n; i++)                          " << endl;        Sleep(30);
  213.                 cout << "       {                                                     " << endl;        Sleep(30);
  214.                 cout << "           if (arr[i] % 2 != 0)                              " << endl;        Sleep(30);
  215.                 cout << "           {                                                 " << endl;        Sleep(30);
  216.                 cout << "               sum = sum + fact(arr[i]);                     " << endl;        Sleep(30);
  217.                 cout << "           }                                                 " << endl;        Sleep(30);
  218.                 cout << "       }                                                     " << endl;        Sleep(30);
  219.                 cout << "    cout<<'Сумма факториалов нечетных чисел = '<<sum<<endl;" << endl;        Sleep(30);
  220.                 cout << "}                                                          " << endl;        Sleep(30);
  221.                 break;
  222.             case 2:
  223.                 ShellExecute(NULL, "open","D:\\практика\\5\\Source5.exe ", NULL, NULL, SW_SHOWDEFAULT);
  224.             }
  225.             cout << endl;
  226.             system("pause");
  227.             cout << endl;
  228.  
  229.             break;
  230.         case 4:
  231.             cout << "Задача №14" << endl;                                                                 Sleep(30);
  232.             cout << endl;
  233.             cout << "Условие задачи:" << endl;                                                            Sleep(30);
  234.             cout << endl;
  235.             cout << "Среди введенных слов распечатать сначала те, которые начинаются " << endl;           Sleep(30);
  236.             cout << "и оканчиваются одной и той де буквой,а затем  - все остальные " << endl;             Sleep(30);
  237.             cout << "(слова выводить по одному на строке) " << endl << endl;                                 Sleep(30);
  238.             cout << "\n[1]Вывести листинг программы" << endl;                                               Sleep(30);
  239.             cout << "\n[2]Запустить программу" << endl << endl << ">";                                          Sleep(30);
  240.             cin >> counter;
  241.             cout << endl;
  242.             switch (counter)
  243.             {
  244.             case 1:
  245.                 cout << "#include <iostream>                             " << endl;                    Sleep(20);
  246.                 cout << "#include <fstream>                              " << endl;                    Sleep(20);
  247.                 cout << "#include <string>                               " << endl;                    Sleep(20);
  248.                 cout << "#include <sstream>                              " << endl;                    Sleep(20);
  249.                 cout << "                                                " << endl;                    Sleep(20);
  250.                 cout << "using namespace std;                            " << endl;                    Sleep(20);
  251.                 cout << "                                                " << endl;                    Sleep(20);
  252.                 cout << "void f14 (char *str) {                          " << endl;                    Sleep(20);
  253.                 cout << "   char c;                                        " << endl;                    Sleep(20);
  254.                 cout << "   int ins_word = 1;                              " << endl;                    Sleep(20);
  255.                 cout << "                                                " << endl;                    Sleep(20);
  256.                 cout << "   char *frst_sym = str;                          " << endl;                    Sleep(20);
  257.                 cout << "   char *last_spc;                                " << endl;                    Sleep(20);
  258.                 cout << "                                                " << endl;                    Sleep(20);
  259.                 cout << "scan:                                           " << endl;                    Sleep(20);
  260.                 cout << "   c = *str;                                      " << endl;                    Sleep(20);
  261.                 cout << "   goto srv;                                      " << endl;                    Sleep(20);
  262.                 cout << "                                                " << endl;                    Sleep(20);
  263.                 cout << "srv:                                            " << endl;                    Sleep(20);
  264.                 cout << "   if ( (c == ' ') || (c == '\0')) {              " << endl;                    Sleep(20);
  265.                 cout << "       if (ins_word == 1) {                       " << endl;                    Sleep(20);
  266.                 cout << "           last_spc = str;                        " << endl;                    Sleep(20);
  267.                 cout << "           ins_word = 0;                          " << endl;                    Sleep(20);
  268.                 cout << "           str++;                                 " << endl;                    Sleep(20);
  269.                 cout << "           goto print;                            " << endl;                    Sleep(20);
  270.                 cout << "       }                                          " << endl;                    Sleep(20);
  271.                 cout << "       str++;                                     " << endl;                    Sleep(20);
  272.                 cout << "       goto scan;                                 " << endl;                    Sleep(20);
  273.                 cout << "   }                                              " << endl;                    Sleep(20);
  274.                 cout << "   else {                                         " << endl;                    Sleep(20);
  275.                 cout << "       if (ins_word == 0) {                       " << endl;                    Sleep(20);
  276.                 cout << "           frst_sym = str;                        " << endl;                    Sleep(20);
  277.                 cout << "           ins_word = 1;                          " << endl;                    Sleep(20);
  278.                 cout << "       }                                          " << endl;                    Sleep(20);
  279.                 cout << "       str++;                                     " << endl;                    Sleep(20);
  280.                 cout << "       goto scan;                                 " << endl;                    Sleep(20);
  281.                 cout << "   }                                              " << endl;                    Sleep(20);
  282.                 cout << "                                                " << endl;                    Sleep(20);
  283.                 cout << "print:                                          " << endl;                    Sleep(20);
  284.                 cout << "   if (*(last_spc - 1) == *frst_sym) {            " << endl;                    Sleep(20);
  285.                 cout << "       for ( ; frst_sym != last_spc; frst_sym++) {" << endl;                    Sleep(20);
  286.                 cout << " std::cout<<*frst_sym;                          " << endl;                    Sleep(20);
  287.                 cout << "       }                                          " << endl;                    Sleep(20);
  288.                 cout << "       std::cout<<'\n';                           " << endl;                    Sleep(20);
  289.                 cout << "   }                                              " << endl;                    Sleep(20);
  290.                 cout << "   if (c == '\0')                                 " << endl;                    Sleep(20);
  291.                 cout << "       return;                                    " << endl;                    Sleep(20);
  292.                 cout << "   goto scan;                                     " << endl;                    Sleep(20);
  293.                 cout << "}                                               " << endl;                    Sleep(20);
  294.                 cout << "                                                " << endl;                    Sleep(20);
  295.                 cout << "void f14_1 (char *str) {                        " << endl;                    Sleep(20);
  296.                 cout << "   char c;                                        " << endl;                    Sleep(20);
  297.                 cout << "   int ins_word = 1;                              " << endl;                    Sleep(20);
  298.                 cout << "                                                " << endl;                    Sleep(20);
  299.                 cout << "   char *frst_sym = str;                          " << endl;                    Sleep(20);
  300.                 cout << "   char *last_spc;                                " << endl;                    Sleep(20);
  301.                 cout << "                                                " << endl;                    Sleep(20);
  302.                 cout << "scan:                                           " << endl;                    Sleep(20);
  303.                 cout << "   c = *str;                                      " << endl;                    Sleep(20);
  304.                 cout << "   goto srv;                                      " << endl;                    Sleep(20);
  305.                 cout << "                                                " << endl;                    Sleep(20);
  306.                 cout << "srv:                                            " << endl;                    Sleep(20);
  307.                 cout << "   if ( (c == ' ') || (c == '\0')) {              " << endl;                    Sleep(20);
  308.                 cout << "       if (ins_word == 1) {                       " << endl;                    Sleep(20);
  309.                 cout << "           last_spc = str;                        " << endl;                    Sleep(20);
  310.                 cout << "           ins_word = 0;                          " << endl;                    Sleep(20);
  311.                 cout << "           str++;                                 " << endl;                    Sleep(20);
  312.                 cout << "           goto print;                            " << endl;                    Sleep(20);
  313.                 cout << "       }                                          " << endl;                    Sleep(20);
  314.                 cout << "       str++;                                     " << endl;                    Sleep(20);
  315.                 cout << "       goto scan;                                 " << endl;                    Sleep(20);
  316.                 cout << "   }                                              " << endl;                    Sleep(20);
  317.                 cout << "   else {                                         " << endl;                    Sleep(20);
  318.                 cout << "       if (ins_word == 0) {                       " << endl;                    Sleep(20);
  319.                 cout << "           frst_sym = str;                        " << endl;                    Sleep(20);
  320.                 cout << "           ins_word = 1;                          " << endl;                    Sleep(20);
  321.                 cout << "       }                                          " << endl;                    Sleep(20);
  322.                 cout << "       str++;                                     " << endl;                    Sleep(20);
  323.                 cout << "       goto scan;                                 " << endl;                    Sleep(20);
  324.                 cout << "   }                                              " << endl;                    Sleep(20);
  325.                 cout << "                                                " << endl;                    Sleep(20);
  326.                 cout << "print:                                          " << endl;                    Sleep(20);
  327.                 cout << "   if (*(last_spc - 1) != *frst_sym) {            " << endl;                    Sleep(20);
  328.                 cout << "       for ( ; frst_sym != last_spc; frst_sym++)  " << endl;                    Sleep(20);
  329.                 cout << "           {std::cout<<*frst_sym; }               " << endl;                    Sleep(20);
  330.                 cout << "       std::cout<<'\n';                           " << endl;                    Sleep(20);
  331.                 cout << "   }                                              " << endl;                    Sleep(20);
  332.                 cout << "   if (c == '\0')                                 " << endl;                    Sleep(20);
  333.                 cout << "       return;                                    " << endl;                    Sleep(20);
  334.                 cout << "   goto scan;                                     " << endl;                    Sleep(20);
  335.                 cout << "}                                               " << endl;                    Sleep(20);
  336.                 cout << "                                                " << endl;                    Sleep(20);
  337.                 cout << "                                                " << endl;                    Sleep(20);
  338.                 cout << "int main (void) {                               " << endl;                    Sleep(20);
  339.                 cout << "   char s[]='ada dds ada dds';                    " << endl;                    Sleep(20);
  340.                 cout << "   f14 (s);                                       " << endl;                    Sleep(20);
  341.                 cout << "   f14_1 (s);                                     " << endl;                    Sleep(20);
  342.                 cout << "   return 0;                                      " << endl;                    Sleep(20);
  343.                 cout << "}                                               " << endl;                    Sleep(20);
  344.                 break;
  345.             case 2:
  346.                 ShellExecute(NULL, "open", "D:\\практика\\14.1\\main.exe", NULL, NULL, SW_SHOWDEFAULT);
  347.             }
  348.             cout << endl;
  349.             system("pause");
  350.             cout << endl;
  351.  
  352.             break;
  353.         case 5:
  354.             cout << "Задача №15" << endl;                                                                 Sleep(30);
  355.             cout << endl;
  356.             cout << "Условие задачи:" << endl;                                                            Sleep(30);
  357.             cout << endl;
  358.             cout << "В файле содержится список слов. Распечатать те из них, которые " << endl;            Sleep(30);
  359.             cout << "начинаются и оканчиваются одной и той же буквой" << endl << endl;                       Sleep(30);
  360.             cout << "\n[1]Вывести листинг программы" << endl;                                               Sleep(30);
  361.             cout << "\n[2]Запустить программу" << endl << endl << ">";                                          Sleep(30);
  362.             cin >> counter;
  363.             cout << endl;
  364.             switch (counter)
  365.             {
  366.             case 1:
  367.                 cout << "#include <iostream>                                   " << endl;              Sleep(30);
  368.                 cout << "#include <fstream>                                    " << endl;              Sleep(30);
  369.                 cout << "#include <string>                                     " << endl;              Sleep(30);
  370.                 cout << "#include <sstream>                                    " << endl;              Sleep(30);
  371.                 cout << "                                                      " << endl;              Sleep(30);
  372.                 cout << "using namespace std;                                  " << endl;              Sleep(30);
  373.                 cout << "                                                      " << endl;              Sleep(30);
  374.                 cout << "int main()                                            " << endl;              Sleep(30);
  375.                 cout << "{                                                     " << endl;              Sleep(30);
  376.                 cout << "string s;                                             " << endl;              Sleep(30);
  377.                 cout << "ifstream F;                                           " << endl;              Sleep(30);
  378.                 cout << "F.open('D:\\Практика\\Задания\\15\\111.txt', ios::in);" << endl;              Sleep(30);
  379.                 cout << "                                                      " << endl;              Sleep(30);
  380.                 cout << "getline(F, s);                                        " << endl;              Sleep(30);
  381.                 cout << "cout << s << endl<<endl;                              " << endl;              Sleep(30);
  382.                 cout << "stringstream strm(s);                                 " << endl;              Sleep(30);
  383.                 cout << "for (string i; strm >> i;)                            " << endl;              Sleep(30);
  384.                 cout << "   if (i[0] == i[i.length() - 1])                     " << endl;              Sleep(30);
  385.                 cout << "       cout << i << endl;                             " << endl;              Sleep(30);
  386.                 cout << "return 0;                                             " << endl;              Sleep(30);
  387.                 cout << "}                                                     " << endl;              Sleep(30);
  388.                 break;
  389.             case 2:
  390.                 ShellExecute(NULL, "open", "D:\\практика\\15\\Source.exe", NULL, NULL, SW_SHOWDEFAULT);
  391.             }
  392.             cout << endl;
  393.             system("pause");
  394.             cout << endl;
  395.  
  396.             break;
  397.         case 0:
  398.             goto loop;
  399.             }
  400.         }
  401.         }
  402.             case 2:
  403.             {
  404.                 exit = true;
  405.                 cout << endl << "Нажмите любую кнопку для выхода из программы" << endl;
  406.                 break;
  407.             }
  408.     }
  409. }
  410. getch();
  411. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement