Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C++ to implement School Method for Integer Addition and Karatsuba Algorithm for Integer Multiplication Your submission should contain exactly one file: main.cpp. You do

Use C++ to implement School Method for Integer Addition and Karatsuba Algorithm for Integer Multiplication

image text in transcribed

Your submission should contain exactly one file: main.cpp. You do not need to submit a design. Your program takes one line as input. The input line contains three integers separated by spaces. Let the three integers be I1, 12, and B. I1 and 12 are both nonnegative integers up to 100 digits long (there are no leading Os, except when the value itself is 0). B is I1 and 12's base (B is from 2 to 10).1 Your program should output the sum of I1 and 12, using the school method, then the product of I1 and 12, 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. It's not covered in lectures. 12 will ot be 0. The results should still use base B. Please separate the results using one space. Sample input 1: 101 5 10 Sample output 1: 106 505 20 Sample input 2 10 111 2 Sample output 2: 1001 1110 0 Sample input 3: 111 102 Sample output 2: 1001 1110 11 If you are an undergraduate student, simply output 0 as the division result. For sample 3, instead of 1001 10 11, simply output 1001 1110 0

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions