Guest User

Untitled

a guest
Nov 13th, 2018
85
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double Xk, D, wynik;
  9. double lambda = 0.00000066;
  10. /*int i = 1;
  11. while (true) {
  12. cout << "X" << i << ": ";
  13. cin >> Xk;
  14. cout << "D: ";
  15. cin >> D;
  16. cout << "k" << i << ": ";
  17. cin >> k;
  18.  
  19. wynik = ((sqrt((Xk * Xk) + (D * D))) * k * lambda) / Xk;
  20. cout << "wynik d: " << wynik << endl << endl;
  21. i++;
  22. }*/
  23.  
  24. cout << "D - odleglosc siatki od kartki papieru" << endl;
  25. cout << "Xk - odleglosc k-tych punktów od siebie zaznaczonych na kartce" << endl;
  26. cout << "k - numer liczonego punktu" << endl << endl;
  27.  
  28. D = 57.0;
  29. cout << "D: " << D << " cm" << endl << endl;
  30. for (int i = 1; i <= 4; i++) {
  31. switch (i) {
  32. case 1: Xk = 6.0 / 2;
  33. break;
  34. case 2: Xk = 11.9 / 2;
  35. break;
  36. case 3: Xk = 18.0 / 2;
  37. break;
  38. case 4: Xk = 24.2 / 2;
  39. break;
  40. default: Xk = 0;
  41. break;
  42. }
  43. wynik = (((sqrt((Xk * Xk) + (D * D))) * i) / Xk) * lambda;
  44. cout << "k: " << i << endl;
  45. cout << "Xk: " << Xk << " cm" << endl;
  46. cout << "wynik d: " << wynik << " m" << endl << endl;
  47. }
  48.  
  49. cout << endl << endl << endl << endl;
  50.  
  51. D = 35.0;
  52. cout << "D: " << D << " cm" << endl << endl;
  53. for (int i = 1; i <= 7; i++) {
  54. switch (i) {
  55. case 1: Xk = 3.8 / 2;
  56. break;
  57. case 2: Xk = 7.6 / 2;
  58. break;
  59. case 3: Xk = 11.4 / 2;
  60. break;
  61. case 4: Xk = 15.4 / 2;
  62. break;
  63. case 5: Xk = 19.5 / 2;
  64. break;
  65. case 6: Xk = 23.8 / 2;
  66. break;
  67. case 7: Xk = 28.3 / 2;
  68. break;
  69. default: Xk = 0;
  70. break;
  71. }
  72. wynik = (((sqrt((Xk * Xk) + (D * D))) * i) / Xk) * lambda;
  73. cout << "k: " << i << endl;
  74. cout << "Xk: " << Xk << " cm" << endl;
  75. cout << "wynik d: " << wynik << " m" << endl << endl;
  76. }
  77.  
  78. cout << endl << endl << endl << endl;
  79.  
  80. D = 16.0;
  81. cout << "D: " << D << " cm" << endl << endl;
  82. for (int i = 1; i <= 13; i++) {
  83. switch (i) {
  84. case 1: Xk =1.7 / 2;
  85. break;
  86. case 2: Xk = 3.3 / 2;
  87. break;
  88. case 3: Xk = 4.9 / 2;
  89. break;
  90. case 4: Xk = 6.5 / 2;
  91. break;
  92. case 5: Xk = 8.2 / 2;
  93. break;
  94. case 6: Xk = 10.0 / 2;
  95. break;
  96. case 7: Xk = 11.9 / 2;
  97. break;
  98. case 8: Xk = 13.9 / 2;
  99. break;
  100. case 9: Xk = 16.1 / 2;
  101. break;
  102. case 10: Xk =18.5 / 2;
  103. break;
  104. case 11: Xk = 21.1 / 2;
  105. break;
  106. case 12: Xk = 24.1 / 2;
  107. break;
  108. case 13: Xk = 27.8 / 2;
  109. break;
  110. default: Xk = 0;
  111. break;
  112. }
  113. wynik = (((sqrt((Xk * Xk) + (D * D)))) / Xk) * i * lambda;
  114. cout << "k: " << i << endl;
  115. cout << "Xk: " << Xk << " cm" << endl;
  116. cout << "wynik d: " << wynik << " m" << endl << endl;
  117. }
  118.  
  119. return 0;
  120. }
RAW Paste Data