Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <QCoreApplication>
  2. #include <iostream>
  3. #include <stdio.h>
  4. #include <QDebug>
  5. #include <stdlib.h>
  6. using namespace std;
  7. const int i1=2;
  8. const int j1=2;
  9. int main(int argc, char *argv[])
  10. {
  11. QCoreApplication a(argc, argv);
  12.  
  13. setlocale(LC_ALL, "Rus");
  14. int menu,i,j,p;
  15. int matr [i1][j1];
  16. qDebug () << "Меню: \n 1) Ввод цикла с квалиатуры; \n 2) Ввод цикла рандомом.";
  17. cin >> menu;
  18. switch (menu)
  19. {
  20. case 1:
  21. {
  22. for (i=0; i<i1; i++)
  23. {
  24. for (j=0; j<j1; j++)
  25. cin >> matr[i][j];
  26. break;
  27. }
  28. }
  29. case 2:
  30. {
  31. for (i=0; i<i1; i++)
  32. {
  33. for (j=0; j<j1; j++)
  34. matr[i][j] = rand(101)-50;
  35. }
  36. }
  37. break;
  38.  
  39. }
  40. p = p+matr[i][j];
  41. cout << p;
  42.  
  43. system("pause");
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement