COMP-SCI 7201 Assignment 1 C++ Implementation of Integer Addition and Multiplication solution

$40.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (5 votes)

1 Task Description

You are asked to use C++ to implement
• School Method for Integer Addition and Karatsuba Algorithm for Integer Multiplication

2 Submission Guideline

You must follow this guideline! Your submission will be tested automatically. Failure to follow
this guideline will result in 0.

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, 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 I2’s base (B is from 2 to 10).1
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.

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
Sample input 2: 10 111 2
Sample output 2: 1001 1110
Sample input 3: 111 10 2
Sample output 2: 1001 1110

3 SVN Instructions

First of all, you need to create a directory under version control:
svn mkdir –parents -m “Creating ADSA Assignment 1 folder” https://version-control.adelaide.edu.au/svn/aXXXXXXX/2020/s1/adsa/assignment1/
aXXXXXXX should be your student ID. The directory path needs to be exactly “2020/s1/adsa/assignmentK”,
where “K” is the assignment number.

To check out a working copy, type
svn checkout https://version-control.adelaide.edu.au/svn/aXXXXXXX/2020/s1/adsa/assignment1/ adsa-20-s1-assignment1/
cd adsa-20-s1-assignment1
svn add main.cpp

Commit the files to SVN:
1This makes your life easier as you do not have to deal with numbers like ‘aff’.
1
svn commit -m “Adding ADSA assignment 1 main.cpp”
SVN helps keeping track of file changes (over different commits). You should commit your work early
and often.

4 Websubmission

You are asked to submit via the web interface https://cs.adelaide.edu.au/services/websubmission/.
The submission steps should be self-explanatory. Simply choose the correct semester, course, and assignment.

The websubmission system will automatically fetch the latest version of your work from your SVN repository
(you may also choose to submit older versions). Once your work is submitted, the system will launch a script
checking the format of your submission. Click “View Feedback” to view the test results. You are welcome
to resubmit for as many times as you wish (before the deadline).

We will compile your code using g++ -std=c11 -o main.out -O2 -Wall main.cpp. It is your responsibility to ensure that your code compiles on the university system.

2
2g++ has too many versions, so being able to compile on your laptop does not guarantee that it compiles on the university
system. You are encouraged to debug your code on a lab computer (or use SSH).
2