Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. cout << "Podaj wielkosc strzalki" << endl;
  8. int wielkosc;
  9.  
  10. cin >> wielkosc;
  11. for (int i=0; i<wielkosc; i++)
  12. {
  13. for(int i=0;i<((2*wielksc)-1);i++)
  14. {
  15. for (int i=0;i<(wielkosc-i);i++)
  16. {
  17. cout << ' ';
  18. }
  19. cout << '*'<<endl;
  20. }
  21. }
  22.  
  23. }
  24.  
  25.  
  26. return 0;
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33. #include <iostream>
  34.  
  35. using namespace std;
  36. float funkcja(double nr, int b, int c);
  37. int main()
  38. {
  39. cout << "Witaj w programie ktory liczy wartosc" << endl;
  40. int numerindeksu;
  41. cout << "twoj numer indeksu to"<< endl;
  42. cin >> numerindeksu;
  43.  
  44. cout <<"Podaj wartosc b: ";
  45. int b1;
  46. cin >> b1;
  47. cout <<"Podaj wartosc c: ";
  48. int c1;
  49. cin >>c1;
  50. float wynik;
  51. wynik=funkcja(numerindeksu,b1,c1);
  52.  
  53. if(wynik>4000)
  54. cout << "Wynik jest wiekszy od 40000" << endl;
  55. else if ((wynik>15000) && (wynik <4000))
  56. cout << "Wynik zawiera sie w przedziale od 15000 do 40000" << endl;
  57. else
  58. cout << "Wynik jest mniejszy od 15000" << endl;
  59.  
  60.  
  61.  
  62. return 0;
  63. }
  64.  
  65. float funkcja(double nr, int b, int c)
  66. {
  67.  
  68. return(nr+b)/c;
  69.  
  70. }
  71.  
  72.  
  73.  
  74. #include <iostream>
  75. #include <iomanip>
  76.  
  77. using namespace std;
  78. void zaokraglenie(float &a);
  79. int main()
  80. {
  81. float tab[10];
  82. float suma = 0;
  83. cout << "Witaj w programie ktory zaokragla" << endl;
  84.  
  85. float liczba;
  86.  
  87. int i;
  88. i = 0;
  89. while (i<10)
  90. {
  91. cout << "Podaj lizcbe: ";
  92. cin >> liczba;
  93. zaokraglenie(liczba);
  94. tab[i] = liczba;
  95. suma = suma + tab[i];
  96. i++;
  97. }
  98. i = 0;
  99. while (i<10)
  100. {
  101. cout << "Zaokraglenie wynosi: ";
  102. cout << setprecision(2) << tab[i] << endl;
  103.  
  104. i++;
  105. }
  106. cout.precision(2);
  107. cout << "Suma podanych liczb wynosi: " << setprecision(2) << suma << endl;
  108.  
  109.  
  110.  
  111.  
  112. return 0;
  113. }
  114. void zaokraglenie(float &a)
  115. {
  116. float wynik;
  117. int cal = (int)a;
  118. wynik = a - cal;
  119. if (wynik<0.5)
  120. {
  121. a = cal;
  122. }
  123.  
  124. else
  125. a = cal + 1;
  126.  
  127.  
  128.  
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement