fork download
  1. // tester.cpp : Defines the entry point for the console application.
  2. //
  3. #include <iostream>
  4. using namespace std;
  5. const int n=10;
  6.  
  7. /*tutaj zaczyna się zadanie*/
  8. int zadanie5(int m, int n, int c , int d, int tab[], int tabb[])
  9. {
  10. for(int i=0;i<n;i++){
  11. if (tab[i]>c && tab[i]<d){
  12. m=m+1;
  13. tabb[i]=tab[i];
  14. }
  15. else
  16. {
  17. tabb[i]=0;
  18. }
  19. };
  20. /*TEST*/
  21. cout << "\n";
  22. for(int i=0; i<10;i++) {
  23. cout << tabb[i] <<"\n";
  24. };
  25. /*END TEST*/
  26. return tabb[m];
  27. };
  28. /*tutaj kończy się zadanie*/
  29. int main()
  30. {
  31. int m=0;
  32. int c;
  33. int d;
  34. int tab[n];
  35. int tabb[n];
  36. cout << "Podaj c ";
  37. cin >> c ;
  38. cout << "Podaj d ";
  39. cin >> d ;
  40. for(int i=0; i<10;i++) {
  41. tab[i]=i;
  42. };
  43. for(int i=0; i<10;i++) {
  44. cout << tab[i] <<"\n";
  45. };
  46. zadanie5(m,n,c,d,tab,tabb);
  47. cout << "\n";
  48. for(int i=0; i<10;i++) {
  49. cout << tabb[i] <<"\n";
  50. };
  51. return 0;
  52. }
Success #stdin #stdout 0s 3344KB
stdin
4
7
stdout
Podaj c Podaj d 0
1
2
3
4
5
6
7
8
9

0
0
0
0
0
5
6
0
0
0

0
0
0
0
0
5
6
0
0
0