Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <locale>
- #include <cstdlib>
- #include <fstream>
- #include <string>
- #include <algorithm>
- using namespace std;
- int main()
- {
- setlocale(0, "");
- ofstream fout("output.txt");
- int N, k;
- cout << "Введiть кiлькiсть чисел:" << endl;
- cin >> N;
- int* A = new int[N];
- k = 0;
- for (int i = 0; i < N; i++)
- {
- A[i] = rand() % 101;
- if (((int)sqrt(A[i]) == sqrt(A[i])) && (A[i] % 2)) k++;
- fout << A[i] << " ";
- }
- fout.close();
- string line;
- ifstream in("output.txt");
- if (in.is_open())
- {
- while (getline(in, line))
- {
- cout << line << " ";
- }
- }
- in.close();
- cout << "\nКiлькiсть квадратiв: " << k << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment