Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- void inputIndivid()
- {
- int i = 0;
- int temp = 0;
- ifstream in;
- in.open("in.txt");
- if (in.fail())
- {
- cout << "Ошибка открытия документа!" << endl;
- system("pause");
- exit(1);
- }
- else
- {
- while (!in.eof())
- {
- in >> temp;
- if ( temp % 2 != 0 && sqrt(temp) * sqrt(temp) == temp)
- {
- i ++;
- }
- }
- cout << "колво квадратов нечетных чисел = " << i << "" << endl;
- }
- in.close();
- }
- int main()
- {
- setlocale(LC_ALL, "");
- inputIndivid();
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement