Discussion:
[問題] 請各位大大解答一下吧!!
(时间太久无法回复)
2007-03-21 10:34:11 UTC
Permalink
恩=''=我朋友不會用PTT 要我幫忙問的 如果太低級 請各位見諒@@
(Print distinct numbers)
Write a program that reads in ten numbers and displays distinct numbers
(i.e.,if a numbers appears multiple times,it is displayed only once).
Hint:Read a number and store it to an array if it is new.If the number
is already in the array,discard it.After the input,the array contains
the distinct numbers.
麻煩各位大大解答一下囉~~~~因為我才大一 只有學過C++ 所以沒辦法幫我朋友解答@@

--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.118.230.57
骨頭
2007-03-21 11:10:32 UTC
Permalink
※ 引述《kiss90483 (魚)》之銘言:
: 恩=''=我朋友不會用PTT 要我幫忙問的 如果太低級 請各位見諒@@
: (Print distinct numbers)
: Write a program that reads in ten numbers and displays distinct numbers
: (i.e.,if a numbers appears multiple times,it is displayed only once).
: Hint:Read a number and store it to an array if it is new.If the number
: is already in the array,discard it.After the input,the array contains
: the distinct numbers.
: 麻煩各位大大解答一下囉~~~~因為我才大一 只有學過C++ 所以沒辦法幫我朋友解答@@

要偷懶的話,拿個HashSet裝起來就好了,
還有這個問題不分語言,因為所有的語言都有array跟if-else。


叫你朋友回去翻翻array的部份吧。(或者List)
不然就叫他說說看他卡在哪,這裡不是問作業的版。

--
 String temp="relax"; | Life just like programing
 while(buringlife) String.forgot(temp); | to be right or wrong
 while(sleeping) brain.setMemoryOut(); | need not to say
 stack.push(life.running); | the compiler will
 stack.push(scouting.buck()); | answer your life
 stack.push(bowling.practice()); | Bone everything

--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.27.68

Loading...