int list_recursive(t_dlist *list, t_dlist *first, char ***pointed_square, int size, int tmp_lin, int tmp_col) { int result; int lin; int col; char **square; square = *pointed_square; (void)first; lin = 0; col = 0; result = (is_right(&square, &lin, &col, size, list)); print_it(list->content); ft_putnbr(result); /*if (result == 1 && list-> next != NULL) { tmp_lin = lin; tmp_col = col; list = list -> next; list_recursive (list, first, square, size, tmp_lin, tmp_col); }*/ ft_putstr("salut"); if (result == 0 && list->prev != NULL) { list = list -> prev; malloc_square(size); ft_putchar('M'); result = is_right (&square, &tmp_lin +1, &tmp_col + 1, size, list); print_it(list->content); ft_putnbr(result); } if (result == 1 && list-> next != NULL) { ft_putstr("post_M"); tmp_lin = lin; tmp_col = col; list = list -> next; list_recursive (list, first, &square, size, tmp_lin, tmp_col); } if (result == 0 && list->prev == NULL) { ft_putstr("yolo"); return (0); } if (result == 1 && list->next == NULL) { ft_putnbr(8); return (1); } return (0); }
int main(void) { int side1 = 3, side2 = 4, side3 = 5; printf("%d, %d, and %d are ", side1, side2, side3); if(!is_right(side1, side2, side3)) { printf("NOT "); } puts("the sides of a right triangle"); }
main() { int side1 = 3, side2 = 4, hypotenuse = 5; printf ("%d, %d, and %d are ", side1, side2, hypotenuse); if ( is_right(side1, side2, hypotenuse) == 0 ) { printf("NOT "); } printf("the sides of a right triangle\n"); }
int main(int argc, char *argv[]){ long n,i,beg,end; char str[LEN]; scanf("%s\n",str); scanf ("%ld\n",&n); for(i=0;i<n;i++){ scanf("%ld %ld\n",&beg,&end); if(is_right(str,beg,end)) printf("Y\n"); else printf("N\n"); } return 0; }
int parse_call(FILE *target, char *function, hash_t *var_map) { if(strcmp(function, "print") != 0){ printf("The function call %s is not supported\n", function); return 1; } if(next() == false){ printf("Not enough arguments to the function call %s\n", function); return 1; } if(is_string()){ char *call = get_token(); write_one_operand_call(target, PUSHS, call); } else if(is_alpha()){ char *var_name = get_token(); char *var_value = hash_lookup(var_map, var_name); if(NULL == var_value){ printf("The variable %s does not exist\n", var_name); return 1; } write_variable_name(target, PUSHV, var_name); } else { printf("Can only pass string or a variable to a function call\n"); return 1; } if(next() == false || is_right() == false){ printf("The function call must be closed with a right parenthesis\n"); return 1; } if(next() == false || is_stop() == false){ printf("Every instruction must be closed by a semicolon\n"); return 1; } write_simple_call(target, PRINT); return 0; }
int main() { struct ID_table ID; int i; for(i = 0 ; i < 9 ; i++) ID.per_num[i] = 0; get_number( &ID ); is_right( &ID ); print_result( &ID ); return 0; }
int is_right (char ***pointed_square, int *lin_tmp, int *col_tmp,int size, t_dlist *list) { char **square; int lin; int col; lin = *lin_tmp; col = *col_tmp; square = *pointed_square; if (square[lin][col] == '\0') return (0); if(square[lin][col] == '.' && (col < size)) { if((place_first_tetri_diese(&square, lin, col, list->content, 0,0, size) == 1)) return (1); else return (is_right(&square, &lin, &col+1, size, list)); } if (col == size && lin < size) return (is_right(&square, &lin + 1, 0, size, list)); return (0); }
bin64_t bin64_t::next_dfsio (uint8_t floor) { /*while (ret.is_right()) ret = ret.parent(); ret = ret.sibling(); while (ret.layer()>floor) ret = ret.left();*/ if (is_right()) { return parent(); } else { bin64_t ret = sibling(); while (ret.layer()>floor) ret = ret.left(); return ret; } }
int main(int argc, char* argv[]) { long long x1 = atof(argv[1]); long long y1 = atof(argv[2]); long long x2 = atof(argv[3]); long long y2 = atof(argv[4]); long long x3 = atof(argv[5]); long long y3 = atof(argv[6]); double x1_x2_length = get_side_length(x2, x1, y2, y1); double x2_x3_length = get_side_length(x3, x2, y3, y2); double x1_x3_length = get_side_length(x3, x1, y3, y1); double x1_x2_angle = get_angle(x1_x2_length, x2_x3_length, x1_x3_length); double x2_x3_angle = get_angle(x2_x3_length, x1_x3_length, x1_x2_length); double x1_x3_angle = get_angle(x1_x3_length, x1_x2_length, x2_x3_length); if(!is_a_triangle(x1_x2_length, x2_x3_length, x1_x3_length)) { printf("not a triangle\n"); exit(0); } if(is_scalene(x1_x2_length, x2_x3_length, x1_x3_length)) printf("scalene "); else printf("isosceles "); if(is_right(x1_x2_length, x2_x3_length, x1_x3_length)) printf("right\n"); if(is_acute(x1_x2_angle, x2_x3_angle, x1_x3_angle)) printf("acute\n"); else printf("obtuse\n"); /*printf("x1_x2_length: %f\n", x1_x2_length); printf("x2_x3_length: %f\n", x2_x3_length); printf("x1_x3_length: %f\n", x1_x3_length); printf("x1_x2_angle: %f\n", x1_x2_angle); printf("x2_x3_angle: %f\n", x2_x3_angle); printf("x1_x3_angle: %f\n", x1_x3_angle);*/ return 0; }
int main() { struct ID_table ID; int i; do{ for(i = 0 ; i < 9 ; i++) ID.per_num[i] = 0; get_number( &ID ); depart_class( &ID ); is_right( &ID ); print_result( &ID ); }while(ID.flag != 1); return 0; }
/******************************************************************************************* * NAME : print_classification() * * DESCRIPTION : Prints the classification of the triangle to the console. * Eg: "isosceles right\n", or "scalene obtuse\n", etc. */ void print_classification(void) { if (is_isosceles()) { printf("isosceles "); } else if (is_scalene()) { printf("scalene "); } else { assert(0); /* something went horribly wrong, didn't it */ } if (is_acute()) { printf("acute\n"); } else if (is_right()) { printf("right\n"); } else if (is_obtuse()) { printf("obtuse\n"); } else { assert(0); /* something went horribly wrong, didn't it */ } return; }