[問題] 大數相加 - 測試+Debug
題目:
A char array can be used to store large integers one digit at a time.
For example, the integer 1234 can be stored in the array a by
setting a[0]=’1’, a[1]=’2’, a[2]=’3’, a[3]=’4’.
Write a program that reads in two positive integers, then outputs the sum of
the two integers.
The program using std::vector and without limitation.
In addition, allow the integers to be negative numbers.
簡單來說就是做無限位數(大數)的加法,允許有負數。
程式網址:https://gist.github.com/1290733
有興趣的板友可以幫我想測資,檢查有無問題。
或者可以建議此程式有無任何改進的空間,小弟蠻需要學習的。
基本上已經完成一些簡單的錯誤偵測
可檢查
1. 輸入0~9以外的數字
2. 開頭為0的數字 ex. 09923, -0827429, 是不合法的.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.242.49.84
→
10/16 18:22, , 1F
10/16 18:22, 1F
譬如說 程式流程 結構化 coding寫法
※ 編輯: k0783154 來自: 210.242.49.84 (10/16 18:23)
推
10/16 18:26, , 2F
10/16 18:26, 2F
→
10/16 18:26, , 3F
10/16 18:26, 3F
推
10/16 18:28, , 4F
10/16 18:28, 4F
→
10/16 18:30, , 5F
10/16 18:30, 5F
推
10/16 18:30, , 6F
10/16 18:30, 6F
→
10/16 18:31, , 7F
10/16 18:31, 7F
→
10/16 18:36, , 8F
10/16 18:36, 8F
→
10/16 18:37, , 9F
10/16 18:37, 9F
推
10/16 18:42, , 10F
10/16 18:42, 10F
推
10/16 23:35, , 11F
10/16 23:35, 11F
→
10/16 23:36, , 12F
10/16 23:36, 12F
→
10/16 23:36, , 13F
10/16 23:36, 13F
→
10/16 23:51, , 14F
10/16 23:51, 14F
→
10/17 00:09, , 15F
10/17 00:09, 15F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章