Advertisement
illfate

Untitled

Apr 26th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. void PrintVector(const vector<double>& vect) {
  2. for (double x : vect) {
  3. cout << x << " ";
  4. }
  5. }
  6.  
  7. bool IsInt(double element) {
  8. if (element - static_cast<int>(element) == 0) {
  9. return true;
  10. }
  11. else return false;
  12. }
  13.  
  14. bool CheckSolution(const vector<double>& vect) {
  15. for (size_t i = 0; i < vect.size()-1; i++) {
  16. if (IsInt(vect[i]) == IsInt(vect[i + 1])) {
  17. return false;
  18. }
  19. }
  20. return true;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement