[問題] 用function解阿姆斯壯數
題目:Write a function that determines whether a number is an Armstrong number.
Use this function in a program that prints all Armstrong numbers between
and including 10 and a positive integer (in the range from 10 to 10000000)
input by the user.
程式碼:http://pastie.org/2624919
結果大概是這樣
┌───────────────────────────────┐
│Enter an integer between and including 10 and 10000000: 20000 │
│ │
│Armstrong numbers between and including 10 and 20000: │
│ │
│ 153 │
│ 370 │
│ 371 │
│ 407 │
│ 1634 │
│ 8208 │
│ 9474 │
│請按任意鍵繼續 . . . │
└───────────────────────────────┘
請問function最後的return寫在迴圈裡那回傳到main的時候會有很多個值嗎?
如果要cout每個值那main裡面還要再寫一個迴圈嗎?
我試了很多次還是沒有辦法輸出答案
剛學C++,有很多寫不好的地方請多多指正 :)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.167.191.190
※ 編輯: hedwing 來自: 218.167.191.190 (10/02 11:27)
→
10/02 11:39, , 1F
10/02 11:39, 1F
→
10/02 13:40, , 2F
10/02 13:40, 2F
→
10/02 13:49, , 3F
10/02 13:49, 3F
推
10/02 14:24, , 4F
10/02 14:24, 4F
→
10/02 14:24, , 5F
10/02 14:24, 5F
→
10/02 14:25, , 6F
10/02 14:25, 6F
→
10/02 17:38, , 7F
10/02 17:38, 7F