// Task 4 stringbuilder task_4_ans = task_4_check(x); stringbuilder task_4 = get_bin_2(x); printf("\n");

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

// Task 4 stringbuilder task_4_ans = task_4_check(x); stringbuilder task_4 = get_bin_2(x); printf("\n");

Post by answerhappygod »

Task 4 Stringbuilder Task 4 Ans Task 4 Check X Stringbuilder Task 4 Get Bin 2 X Printf N 1
Task 4 Stringbuilder Task 4 Ans Task 4 Check X Stringbuilder Task 4 Get Bin 2 X Printf N 1 (22.94 KiB) Viewed 40 times
// Task 4
stringbuilder task_4_ans =
task_4_check(x);
stringbuilder task_4 = get_bin_2(x);
printf("\n");
if (!sb_is_equal(task_4, task_4_ans))
printf("FAILED");
else
printf("PASSED");
printf(": GET BINARY 2 (Task 4)\n");
printf("Expected: \"%s\"\n",
*task_4_ans.cars);
printf(" Got: \"%s\"\n",
*task_4.cars);
delete_sb(task_4_ans);
delete_sb(task_4);
printf("\n");
printf("Input a number (1234 to exit): ");
scanf("%d", &x);
Task 4 Get Binary 2: Implement the get_bin_2 function as directed in the comment above the function. If the directions are unclear, run the code, and look at the expected answer for a few inputs. For your solution, you should refer to your solution for Task 2 to get the general idea for Task 4, and you should use largest_po2_le in your solution (think about why this might be useful in terms of the binary representation). Make sure you build the string for 0 and negative numbers correctly. The same restrictions apply from Task 2.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply