Advertisement
Guest User

zadanka

a guest
Dec 12th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. pierwsze:
  2.  
  3. #include <iostream>
  4. #include <cmath>
  5. #include <iomanip>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10.  
  11. int r;
  12. cout << "Wprowadz wartosc promienia: ";
  13. cin >> r;
  14.  
  15. long double pole = 4*M_PI*r*r;
  16. long double objetosc = 4/3*M_PI*r*r*r;
  17.  
  18. cout << "Pole powierzchni kuli: " << "********" << pole << endl;
  19. cout << "Objetosc kuli: " << setprecision(7) << objetosc << endl;
  20.  
  21. return 0;
  22. }
  23.  
  24. ===========================================================
  25. trzecie:
  26.  
  27. #include <iostream>
  28. #include <cstdlib>
  29. #include <ctime>
  30.  
  31. using namespace std;
  32.  
  33. int main() {
  34.  
  35. srand(time(NULL));
  36. int liczba = -32+rand()%(61);
  37. cout << "Wygenerowana liczba to: " << liczba << endl;
  38.  
  39. return 0;
  40. }
  41.  
  42. ==========================================================
  43. czwarte:
  44.  
  45. #include <iostream>
  46. #include <ctime>
  47.  
  48. using namespace std;
  49.  
  50. int main() {
  51.  
  52. int wybor;
  53.  
  54. while (wybor!=4) {
  55. cout << "-=-PROGRAM-=-" << endl;
  56. cout << "1. Dane ucznia" << endl;
  57. cout << "2. Aktualna data" << endl;
  58. cout << "3. Oblicz pole kwadratu!" << endl;
  59. cout << "4. Zakonczenie programu" << endl;
  60.  
  61. cout << endl;
  62. cout << "Wybierz opcje: ";
  63. cin >> wybor;
  64.  
  65. switch(wybor){
  66. case 1:
  67. cout << "Kamila Butrym" << endl;
  68. cout << endl;
  69. break;
  70. case 2:
  71. cout << __DATE__ << endl;
  72. cout << endl;
  73. break;
  74. case 3:
  75. int a;
  76. cout << "Podaj dlugosc boku: ";
  77. cin >> a;
  78. cout << "Pole kwadratu to: " << a*a << endl;
  79. cout << endl;
  80. break;
  81. case 4:
  82. exit(1);
  83. default:
  84. cout << "Bledne dane!" << endl;
  85. cout << endl;
  86. }
  87.  
  88. }
  89.  
  90. return 0;
  91. }
  92.  
  93. ====================================================================
  94. piate (robisz to na kartce, ale kod mi pomogl to rozwiazac):
  95.  
  96. #include <iostream>
  97.  
  98. using namespace std;
  99.  
  100. int main(){
  101.  
  102. int a=6; int b=4; int c=15;
  103.  
  104. b*=2;
  105. c/=4;
  106.  
  107. cout << "wartosc b: " << b << endl;
  108. cout << "wartosc c: " << c << endl;
  109.  
  110. cout << "8-3 = " << b-c << endl;
  111.  
  112. cout << "++b = " << ++b << endl;
  113. cout << "c-- = " << c-- << endl;
  114. cout << "wartosc c: " << c << endl;
  115.  
  116. a/=11;
  117.  
  118. cout << "a/= " << a << endl;
  119.  
  120. return 0;
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement