Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C++ to implement 1. School Method for Integer Addition and Karatsuba Algorithm for Integer Multiplication 2. Integer Division all codes should contain in one

Use C++ to implement 1. School Method for Integer Addition and Karatsuba Algorithm for Integer Multiplication 2. Integer Division all codes should contain in one file TipsThis program takes one line as input. The input line contains three integers separated by spaces. Let the three integers be I1, I2, and B. I1 and I2 are both nonnegative integers up to 100 digits long (there are no leading 0s, except when the value itself is 0). B is I1 and I2s base (B is from 2 to 10). Your program should output the sum of I1 and I2, using the school method, then the product of I1 and I2, using the Karatsuba algorithm, and finally the ratio between I1 and I2 (rounded down). You are asked to come up with a way to perform this division. Its not covered in lectures. I2 will not be 0. The results should still use base B. Please separate the results using one space.

For input 11100111101110001110000000010010011100110011001110000111100011110110110001010000100 111100000011110000101101 2 Output received Enter I1, I2 and B: Output shouldbe 11100111101110001110000000010010011100110011001110000111101011010111001111010110001 11011001011100111100101000100001010011111011011010001101011010100100100111111101000100001110100000100110100 11110110111011011010111111110100101110011000001000101011001

For input 451710053133256677641251311040226202326227045005325205103122312 4516571706445517636723600401754640024213675365546 8 Output received Enter I1, I2 and B: Output shouldbe 451710053133263416433157756560065126126631021645351421000510060 2552243562140011401532646724217051153537454152360561035761647043014346722502103144202523222512076347532750213174 100005255607652

For input 220120202110220201020111002201122122102201101222210221011220001121220201200200200000020101121122212 2200021111000221021022110100112202100 3 Output received Enter I1, I2 and B: Output shouldbe 220120202110220201020111002201122122102201101222210221011220011022012012201121221022200202011102012 2102210211120012010011221001210021000211000110210122222121000121122021210202001210012012001222022012222212100022101200121210210200222200 100011221210012022211201111012120112111010120210220111201222110

For input 443141345699194679297568049518851137706070592528865304184635851601 1124192195894202914342814383877863987801104449453537 10 Output received Enter I1, I2 and B: Output shouldbe 443141345699195803489763943721765480520454470392853105289085305138 498176042513089759041870560828323733844409261439080003302458780955169836390167125802506884440408274813452063076562737 394186463237909

For input 72371771575272033626352757354320366216243475334146041564617073704505632412112753754645122364 6100137142233312110446026725116376053573252155256123517 8 Output received Enter I1, I2 and B: Output shouldbe 72371771575272033626352757354320366224343634476401353675265122631624230465706226132123246103 546206031232224725617035770224602514455571102206346067515524552431511720577100330505477520471434304075652631043164420463571243617743367546666411514 11430663561737427523716053556720103064

For input 281816970980709491748571010256831117372877755196 8791642108213276784712823252411583099955 10 Output received Enter I1, I2 and B: Output shouldbe 281816979772351599961847794969654369784460855151 2477633948883124640820288178879716179514942607465452351764823239724508099514831288616180 32055100

For input 15104030344462410261253143452513334124051165411254160212461503455540460 2111545333425153344320346523326160226511434551464021401114053060 7 Output received Enter I1, I2 and B: Output shouldbe 15104032456341044016436521103163160453241425223022042006513204602623550 35233545466535623345422043252410552003213351223424250524462243466242502650234516625304165222333405016210561620651214065634153643611100 5414341

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions