Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdio.h>
  4. using namespace std;
  5. void masG(int* F,int *G,int N)
  6. {
  7. cout << "MAS G = ";
  8. for (int i = 0;i < N;i++)
  9. {
  10. if (F[i] %5 == 0)
  11. {
  12. G[i] = F[i];
  13. cout << G[i] << " ";
  14. }
  15.  
  16. }
  17.  
  18. }
  19. int main()
  20. {
  21. ifstream file("C:\\Users\\Irinda\\source\\repos\\Задание 1\\text.txt");
  22. if (!file)
  23. {
  24. cout << "File is not open";
  25. return -1;
  26. }
  27. else
  28. {
  29. cout << "File is open" << endl;
  30. const int N = 10;
  31. int F[N];
  32. int G[N];
  33. for (int i = 0;i < N;i++)
  34. {
  35. file >> F[i];
  36. cout << F[i] << " ";
  37. }
  38. cout << endl;
  39. masG(F, G, N);
  40. file.close();
  41. system("pause");
  42. return 0;
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement