Advertisement
Guest User

Untitled

a guest
Mar 31st, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. // Ophui.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <conio.h>
  7. #include <ctime>
  8. #include <iomanip>
  9.  
  10. double ** mas;
  11. int w, h;
  12. using std::cout;
  13. using std::cin;
  14. using std::endl;
  15. using std::setw;
  16. void create()
  17. {
  18. system("cls");
  19. cout << "Введи ширину: ";
  20. cin >> w;
  21. cout << "Введи высоту: ";
  22. cin >> h;
  23. mas = new double*[w];
  24. for (int i = 0; i < w; i++)
  25. mas[i] = new double[h];
  26. for (int i = 0; i < w; i++)
  27. for (int j = 0; j < h; j++)
  28. mas[i][j] = (double)(rand() % (1000 - (-1000) + 1) + (-1000)) / 100;
  29. ;
  30. cout << "Готово!";
  31. _getch();
  32. }
  33. void out()
  34. {
  35. system("cls");
  36. for (int i = 0; i < w; i++)
  37. {
  38. for (int j = 0; j < h; j++)
  39. cout << setw(5) << mas[i][j];
  40. cout << endl;
  41. }
  42. _getch();
  43. }
  44. void work()
  45. {
  46.  
  47. }
  48. int main()
  49. {
  50. srand(time(NULL));
  51. setlocale(LC_ALL, "");
  52. char choice;
  53. do
  54. {
  55. system("cls");
  56. cout << "\tМеню программы 'Оп - хуй' " << endl ;
  57. cout << "Выбери пункт, оп(нажми клавишу, сука): " << endl;
  58. cout << "1: Создание массива\n";
  59. cout << "2: Вывод массива\n";
  60. cout << "3: Обработка массива\n";
  61. cout << "4: Съебаться нахуй\n";
  62. choice = _getch();
  63. switch (choice)
  64. {
  65. case '1':
  66. create();
  67. break;
  68.  
  69. case '2':
  70. out();
  71. break;
  72. case '3':
  73. work();
  74. break;
  75. default:
  76. break;
  77. }
  78.  
  79. } while (choice != '4');
  80. return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement