Question

C++ Please take into consideration the instructions and that it is unsigned integers. Implement the faster...

C++ Please take into consideration the instructions and that it is unsigned integers.

Implement the faster algorithm for integer multiplication in C++ as a function, called “multiply”, that takes 2 UNSIGNED integers and returns their multiplication as an unsigned integer. and Test your code in main.

•Represent integers as strings.

•Write a utility function that pads integers with zeros, this will be useful

1.If the 2 integers differ in length

2.In calculating ??10n and (??+??)10n/2

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>
using namespace std;

int TimesTables (int num);

int main(int argc, const char * argv[]) {
    int number;
    cout << "enter a number to multiply by, with a range of 1-12: ";
    cin >> number;
    if (number < 1 && number > 12)
        return EXIT_FAILURE;
    else {
        int tables = TimesTables(number);
        cout << tables;
    }
    return 0;
}
int TimesTables (int num) {

    for ( int i = 0; num <=12; i ++)
        num = num * i;
    return num;
}
Add a comment
Know the answer?
Add Answer to:
C++ Please take into consideration the instructions and that it is unsigned integers. Implement the faster...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program for the instructions below. Please read the instructions carefully and make sure...

    Write a C++ program for the instructions below. Please read the instructions carefully and make sure they are followed correctly.   please put comment with code! and please do not just copy other solutions. 1. write the code using function 2. Please try to implement a function after the main function and provide prototype before main function. Total Characters in String Array 10 points Problem 2 Declare a string array of size 5. Prompt the user enter five strings that are...

  • Matrix Multiplication with Threads - C/C++ **Please read entire question before answering** In this assignment you...

    Matrix Multiplication with Threads - C/C++ **Please read entire question before answering** In this assignment you will use the Pthreads library to write a program that multiplies two square arrays and compare the difference between the imperative and parallel implementations of this algorithm. Use the matrix mulltiplication algorithm. Write a program that contains three functions: (1) A function that has an integer as a parameter and returns a pointer to square array of integers (i.e. both dimensions should be equal)....

  • PLEASE HELP!!! C PROGRAMMING CODE!!! Please solve these functions using the prototypes provided. At the end...

    PLEASE HELP!!! C PROGRAMMING CODE!!! Please solve these functions using the prototypes provided. At the end please include a main function that tests the functions that will go into a separate driver file. Prototypes int R_get_int (void); int R_pow void R Jarvis int start); void R_fill_array(int arrayll, int len); void R_prt_array (int arrayl, int len) void R-copy-back (int from[], int to [], int len); int R_count_num (int num, int arrayll, int len) (int base, int ex) 3. Build and run...

  • PLEASE IMPLEMENT YOUR SOLUTION RECURSIVELY IN C++. IT WOULD BE GREAT IF YOU COULD ALSO PROVIDE...

    PLEASE IMPLEMENT YOUR SOLUTION RECURSIVELY IN C++. IT WOULD BE GREAT IF YOU COULD ALSO PROVIDE TEST CODE FOR IT. 5) Design a recursive function to find the immediate successor of a target integer in an array o:f sorted integers. Here the immediate successor of a target is defined as the smallest number that is no smaller than the target in this sorted array int binarySuccessor(const int anArrayl, const int first, const int last, int target); In the above function...

  • Need to implement an IterativeMax function in assembly language using the MIPS calling convention. IterativeMax take...

    Need to implement an IterativeMax function in assembly language using the MIPS calling convention. IterativeMax take two arguments: The address of an array of word-long (four byte) signed integers, held in $a0. The length of the array as an unsigned integer, held in $a1. The main purpose of the function is to determine which element of the provided array is the largest (i.e., the maximum element in the array). This is achieved by going through the array one element at...

  • I only need help with the constructors and add method. Thanks! Background Arbitrary length integers are...

    I only need help with the constructors and add method. Thanks! Background Arbitrary length integers are integers that have no size restriction. Recall that the int type has a range of -2,147,483,648 to 2,147,483,647. The long type runs from -263 to 263 - 1. Sometimes these numbers are not large enough. One example application that may need larger numbers is public-key cryptography where very large integers are used to make decryption hard. A large integer may be represented as a...

  • 1. Specification Write a C program to implement a simple calculator that accepts input in the...

    1. Specification Write a C program to implement a simple calculator that accepts input in the following format and displays the result of the computation: calc [operand_1] [operator] [operand_2] The operands operand_1 and operand_2 are non-negative integers. The operator is one of the following: addition (+), subtraction (-), multiplication (x), division (/) and modulo (%). Note: For the multiplication operator, use letter ‘x’. If you use the asterisk ‘*’, your program will not work properly 2. Implementation • The program...

  • Objective: 1. Understand sorting algorithm 2. Implement bubble sort in C++ Check slides for a template...

    Objective: 1. Understand sorting algorithm 2. Implement bubble sort in C++ Check slides for a template of the solution, if you need Write a program that asks users to input 10 integers into an array, write a function that takes the array as its argument, use bubble sort to sort the array and output the sorted array in increasing order. #include <iostream> using namespace std; C:IWINDOWSSystems2cmd.exe lease input 10 integers: void bubblesort(int a[10]) int help; int b[10]; for (int i...

  • C++ Problem 1 Write a function to calculate the greatest common divisor (GCD) of two integers...

    C++ Problem 1 Write a function to calculate the greatest common divisor (GCD) of two integers using Euclid’s algorithm (also known as the Euclidean algorithm). Write a main () function that requests two integers from the user, calls your function to compute the GCD, and outputs the return value of the function (all user input and output should be done in main ()). In particular, you will find this pseudocode for calculating the GCD, which should be useful to you:...

  • I NEED HELP WITH C PROGRAMMING. Answer each of the following. Assume that unsigned integers are...

    I NEED HELP WITH C PROGRAMMING. Answer each of the following. Assume that unsigned integers are stored in 4 bytes and that the starting address of the array is at location 200 600 in memory. i)What address is referenced by vPtr + 5? What value is stored at that location? j) Assuming vPtr points to values[6] , what address is referenced by vPtr -= 4? What value is stored at that location? Also ..... For each of the following, write...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT