fork(4) download
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <conio.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n = 1, k = 0;
  9. int value = 0;
  10. char get;
  11. setlocale(LC_ALL, "Russian");
  12. int *arr_one = new int[n];
  13. do
  14. {
  15. cout << "Введите элемент:" << endl;
  16. cin >> arr_one[n-1];
  17. cout << "Добавить элемент?n - нет, любая клавиша да." << endl;
  18. get = _getch();
  19. if (get != 'n' && get != 'N')
  20. {
  21. n++;
  22. int *arr_two = new int[n];
  23. for (int i = 0; i < n-1; i++)
  24. {
  25. arr_two[i] = arr_one[i];
  26. }
  27. delete[] arr_one;
  28. int *arr_one = new int[n];
  29. for (int i = 0; i < n; i++)
  30. {
  31. arr_one[i] = arr_two[i];
  32. }
  33. delete[] arr_two;
  34. }
  35. else { value = 1; }
  36. } while (value != 1);
  37. for (int i = 0; i < n; i++)
  38. {
  39. cout << arr_one[i]<< endl;
  40. }
  41. system("pause");
  42. return 0;
  43. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:20: fatal error: stdafx.h: No such file or directory
 #include "stdafx.h"
                    ^
compilation terminated.
stdout
Standard output is empty