Find Jobs
Hire Freelancers

C - array/stacks large numbers

$30-60 USD

処理中
投稿日: 19年以上前

$30-60 USD

完了時にお支払い
One possible solution to implement the addition operation is to store the large numbers as strings of numerals, store the numbers corresponding to these numerals in two stacks, and then perform addition by popping numbers from the stacks. The pseudocode for this algorithm is as follows: 1. Read the first number as a string of characters. 2. Store the digit corresponding to each character on a stack (for example, each stack element could hold an int, which would correspond to one character in the input string). The order of pushing the digits on the stack should be such that the least significant digit appears at the top of the stack. 3. Repeat steps 1 and 2 for the second number. 4. Create a stack for the result. 5. set carry = 0. 5. While at least one of the stack is not empty Pop a digit from each non-empty stack and add them. sum = num1 + num2 + carry Push the unit part of sum on the result stack. Save carry. 6. When one of the stacks is empty, push the digits from the other stack on to the result stack, taking care of the carry. 7. If both stacks get empty at the same time, push the carry on the result stack if it is not zero. 7. Pop numbers from the result stack and display them ( as character string). ## Deliverables The project will be limited to developing software for carrying out addition and multiplication of two very large numbers. The basic process will be similar to the way you have been doing multiplication in elementary school ( multiplying by one digit at a time). You can draw upon the idea presented above for addition of two numbers to carry out multiplication. Pop one digit from second stack, and multiply all the digits of first stack with this, and save the result in a temporary stack. Add this to the result stack. **_User Input Specification_** 1. The user will enter a valid input file name. 2. The input file will contain the two character strings representing the two positive numbers. 3. It is specified that the result of the multiplication will not be longer than 100 digits. 4. On prompting the user will enter the output file name. **_Data Processing_** Develop functions for - reading data from file, and writing onto a file . (Convert each character read from the file into the corresponding digit, when building up the stacks. ) - ARRAY BASED push and pop routines which can operate on any one of the stacks at a time. - addition, multiplication and display of results. **_Output Specification_** 1. Save the results of addition and multiplication on two lines in that order, on the output file specified by the user. 2. Display the results on the screen. **_Sample Input File _** *[login to view URL]*. 3523011938638144 619232 **_Sample Output Samples_** Here is a sample output for the file *[login to view URL]*. Enter the name of the file containing the grades **[login to view URL]** Enter the name of the output file to hold the result: **[login to view URL]** Result of addition: 3523011939257376 Result of multiplication: 2181561728786775185408 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables): a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment. b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request. 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). ## Platform Source code in just plain old C
プロジェクト ID: 3380001

プロジェクトについて

5個の提案
リモートプロジェクト
アクティブ 19年前

お金を稼ぎたいですか?

Freelancerで入札する利点

予算と期間を設定してください
仕事で報酬を得る
提案をご説明ください
登録して仕事に入札するのは無料です
アワード者:
ユーザーアバター
See private message.
$34 USD 2日以内
5.0 (54 レビュー)
5.2
5.2
この仕事に5人のフリーランサーが、平均$43 USDで入札しています
ユーザーアバター
See private message.
$42.50 USD 2日以内
5.0 (93 レビュー)
6.0
6.0
ユーザーアバター
See private message.
$51 USD 2日以内
5.0 (100 レビュー)
5.6
5.6
ユーザーアバター
See private message.
$42.50 USD 2日以内
5.0 (51 レビュー)
5.3
5.3
ユーザーアバター
See private message.
$42.50 USD 2日以内
4.9 (91 レビュー)
5.3
5.3

クライアントについて

UNITED STATESのフラグ
United States
5.0
3
メンバー登録日:10月 6, 2004

クライアント確認

このクライアントからの他の仕事

Linked Lists and Polynomials
$30-5000 USD
ありがとうございます!無料クレジットを受け取るリンクをメールしました。
メールを送信中に問題が発生しました。もう一度お試しください。
登録ユーザー 投稿された仕事の合計
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
プレビューを読み込み中
位置情報へのアクセスが許可されました。
あなたのログインセッションの有効期限がきれ、ログアウトされました。もう一度ログインしてください。