P3BigInt - Honors Computer Science I Program 3: BigIntegers...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Honors Computer Science I Program 3: BigIntegers Assigned: 1/23/08 (Wednesday) Due: 2/6/08 (Wednesday 11:55pm over WebCT) The Problem The unsigned int type in C requires 4 bytes of memory storage. With 4 bytes we can store integers as large as 2 32 -1; but what if we need bigger integers, for example ones having hundreds of digits? If we want to do arithmetic with such very large numbers we cannot simply use the unsigned data type. One way of dealing with this is to use a different storage structure for integers, such as linked lists. If we represent an integer as a linked list, we can represent very large integers, where each digit is a node in the list. Since the integers are allowed to be as large as we like, linked lists will prevent the possibility of overflows in representation. However we need new functions to add, subtract, read and write these very large integers. Write a program that will manipulate such arbitrarily large integers. Each integer should be represented as a linked list of digits. You are given a function that reads integers into a linked list. Your program should be able to print an integer and do addition or subtraction as required. Your program should store each decimal digit (0-9) in a separate node of the linked list. In order to perform addition and subtraction more easily, it is better to store the digits in the list in the reverse order. For instance, the value 1234567890 might be stored as: Your program should include the following functions: a function that will read in an integer from the keyboard a function that will print an integer that is stored as a linked list. a function that will add two integers represented as linked lists and returns a
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/09/2009 for the course COP 3223 taught by Professor Guha during the Spring '08 term at University of Central Florida.

Page1 / 4

P3BigInt - Honors Computer Science I Program 3: BigIntegers...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online