fork download
  1.  
  2. #include <iostream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. void funkcja(int n, float tab[])
  8. {
  9. for(int i = 0; i < n; i++)
  10. {
  11. tab[i] = 0;
  12. cout << tab[i] << ' ';
  13. }
  14. cout << endl;
  15.  
  16. for(int i = 0; i < n; i++)
  17. {
  18. tab[i] = i;
  19. cout << tab[i] << ' ';
  20. }
  21. cout << endl;
  22.  
  23. for(int i = 0; i < n; i++)
  24. {
  25. tab[i] *= 2;
  26. cout << tab[i] << ' ';
  27. }
  28. cout << endl;
  29.  
  30. for(int i = 0; i < n; i++)
  31. {
  32. tab[i] = sqrt(tab[i]);
  33. cout << tab[i] << ' ';
  34. }
  35. cout << endl;
  36. }
  37.  
  38. int main()
  39. {
  40. float tab[10];
  41. funkcja(sizeof(tab)/sizeof(tab[0]), tab);
  42. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
0 0 0 0 0 0 0 0 0 0 
0 1 2 3 4 5 6 7 8 9 
0 2 4 6 8 10 12 14 16 18 
0 1.41421 2 2.44949 2.82843 3.16228 3.4641 3.74166 4 4.24264