- 论坛徽章:
- 0
|
新人, 然后有习题不懂得,求大神帮助啊!
第一个问题: 怎么把my $Fe l lows = "despi:55008, pat:55025, serge:55028, norm:55024, " .
"gerd:55011, kris:55018" ; 变成
Number of fellows: 6
My fellows list:
1. despi 55008
2. gerd 55011
3. kris 55018
4. norm 55024
5. pat 55025
6. serge 55028
第二个问题:Enter lines of words:
Come let us hasten to a higher plane
Where dyads tread the fairy fields of Venn
Their indices bedecked from one to n
Commingled in an endless Markov chain
a to us hasten
fields fairy tread the
to one bedecked from
chain Markov an endless
This command prints four words of each line in the order: fourth, third,
rst and second. The arguments of a command are stored in the special
list @ARGV. The input on a LINUX machine was terminated by a Ctrl-D.
On Windows use a Ctrl-Z.
第三个问题:怎么样写一个这样的程序呢?
Enter your initial deposit: 2500
Enter the annual interest rate: 0.05
How many years you do not want to touch the money: 5
*****************************************************
After 0 years you have: $2500
After 1 years you have: $2625
After 2 years you have: $2756.25
After 3 years you have: $2894.0625
After 4 years you have: $3038.765625
After 5 years you have: $3190.70390625
第四个问题:
my $VAR = {
'elements' => {
'element001' => {
'ename' => 'carbon' ,
'aweight' => 1 2 . 0 1 0 ,
'symbol' => 'C' ,
'mpointC' => 3500 ,
},
'element002' => {
'ename' => 'oxygen' ,
'aweight' => 15.999 ,
'symbol' => 'O' ,
'mpointC' => -218.4 ,
} ,
'element003' => {
'ename' => 'aluminum' ,
'aweight' => 26 .981,
'symbol' => 'Al' ,
'mpointC' => 660 ,
} ,
'element004' => {
'ename' => 'neon' ,
'aweight' => 20.179,
'symbol' => 'Ne' ,
'mpointC' => -248.6 ,
} ,
'element005' => {
'ename' => 'fluorine' ,
'aweight' => 18.998 ,
'symbol' => 'F' ,
'mpointC' => -219.62,
}
}
};
使用foreach循环语句,用Fahrenheit_value = (9/5) * Celsius_value + 32这个公式,写出一个这样的东西
Element: aluminum
Symbol : Al
Atomic weight: 26.981
Melting point: 660 (Celsius)
Melting point: 1220 (Fahrenheit)
*************************
Element: carbon
Symbol : C
Atomic weight: 12.01
Melting point: 3500 (Celsius)
Melting point: 6332 (Fahrenheit)
*************************
Element: fluorine
Symbol : F
Atomic weight: 18.998
Melting point: -219.62 (Celsius)
Melting point: -363.316 (Fahrenheit)
*************************
Element: neon
Symbol : Ne
Atomic weight: 20.179
Melting point: -248.6 (Celsius)
Melting point: -415.48 (Fahrenheit)
*************************
Element: oxygen
Symbol : O
Atomic weight: 15.999
Melting point: -218.4 (Celsius)
Melting point: -361.12 (Fahrenheit)
*************************
这个有点多,可能也没有说清楚,
不过真的不知道怎么办了,只好求助大家。
集思广益啊,我也在看小骆驼那本书呢,哎!!!
求各位大神帮助!!!!
|
|