Please all i need is a complete and correct C++ program Develop division algorithm in C++ and verify the correctness usi

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

Please all i need is a complete and correct C++ program Develop division algorithm in C++ and verify the correctness usi

Post by answerhappygod »

Please All I Need Is A Complete And Correct C Program Develop Division Algorithm In C And Verify The Correctness Usi 1
Please All I Need Is A Complete And Correct C Program Develop Division Algorithm In C And Verify The Correctness Usi 1 (46.77 KiB) Viewed 19 times
Please All I Need Is A Complete And Correct C Program Develop Division Algorithm In C And Verify The Correctness Usi 2
Please All I Need Is A Complete And Correct C Program Develop Division Algorithm In C And Verify The Correctness Usi 2 (46.77 KiB) Viewed 19 times
Please All I Need Is A Complete And Correct C Program Develop Division Algorithm In C And Verify The Correctness Usi 3
Please All I Need Is A Complete And Correct C Program Develop Division Algorithm In C And Verify The Correctness Usi 3 (48.57 KiB) Viewed 19 times
Please all i need is a complete and correct C++ program Develop division algorithm in C++ and verify the correctness using 5128 as dividend and 732 as divisor. The output should be 7 for quotient and 4 for remainder Start 1. Subtract the Divisor register from the Remainder register and place the result in the Remainder register Remainder 20 Remainder Quotient What is the number of iterations before 1" non-zero digit populates in quotient? Test Remainder 2a. Shift the Quotient register to the left, setting the new rightmost bit to 1 3. Shift the Divisor register right 1 bit 33rd repetition? Remainder <0 2b. Restore the original value by adding the Divisor register to the Remainder register and placing the sum in the Remainder register. Also shift the Quotient register to the left, setting the new least significant bit to 0 Done Test your code with dividend and divisor in the table below: Dividend 14512 Divisor - 128 Yes: 33 repetitions No: 33 repetitions Dividend=73153 Divisor - 831 Dividend = 98712 Divisor - 56
Overview To print a number in binary for debugging, use bitset: Example: #include #include int main() { int a = 54; std::cout << std::bitset<32>(a) << std::endl; return 0; In C++, int numbers are 32-bit and long long int numbers are 64 bit. Some more binary operations you can perform on these data types are listed below: #include #include int main() { //original int a = 54; std::cout << std::bitset<64>(a) << "< original" << std::endl; // shift left and insert 1 in least significant bit int b = (a << 1) | 0x00000001; std::cout << std::bitset<64> (b) << "< shift-left insert 1" << std::endl; shift left and insert 0 in least significant bit int g = (a << 1) & 0xfffffffe; std::cout << std::bitset<64> (g) << "< shift-left insert 0" << std::endl; // load into upper 64-bit long long int c = a; c = c << 32; std::cout << std::bitset<64> (c) << < insert into upper 32-bit" << std::endl; // test least-significant bit (LSB) int d = 5; std::cout << std::bitset<32>(d) << " < original value" << std::endl; if ((d & 0x00000001) == 1) { std::cout << "1sb of number above is one\n"; else } std::cout << "1sb of number above is zero\n";
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply