fork 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[k];
  17. cout << "Добавить элемент?n - нет, любая клавиша да." << endl;
  18. get = _getch();
  19. if (get != 'n' && get != 'N')
  20. {
  21. n++;
  22. k++;
  23. int *arr_two = new int[n];
  24. for (int i = 0; i < n; i++)
  25. {
  26. arr_two[i] = arr_one[i];
  27. }
  28. delete[] arr_one;
  29. int *arr_one = new int[n];
  30. for (int i = 0; i < n; i++)
  31. {
  32. arr_one[i] = arr_two[i];
  33. }
  34. delete[] arr_two;
  35. }
  36. else { value = 1; }
  37. } while (value != 1);
  38. for (int i = 0; i < n; i++)
  39. {
  40. cout << arr_one[i]<< endl;
  41. }
  42. system("pause");
  43. return 0;
  44. }
  45.  
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