Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- using namespace std;
- ifstream fin("bac.txt");
- bool ePatrat(int nr) {
- if(int(sqrt(nr)) == sqrt(nr))
- return true;
- return false;
- }
- int main()
- {
- int V[1000], total = 0;
- int coord_start = -1, coord_end = -1;
- while(fin >> V[++total])
- {
- if(ePatrat(V[total]) && coord_start == -1)
- coord_start = total;
- else if(ePatrat(V[total]) && coord_start != -1)
- coord_end = total;
- }
- int lungimea = coord_end - coord_start + 1;
- cout << lungimea << "\n";
- for(int i = coord_start; i <= coord_end; i++)
- cout << V[i] << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement