Redian新闻
>
请教家有娃学小提琴的父母,买个啥样的好?
avatar
请教家有娃学小提琴的父母,买个啥样的好?# Parenting - 为人父母
S*I
1
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 4 20:25:58 2011, 美东) 提到:
void reversePrint(Node* head) {
if(head=NULL) {
cout << "Empty List. No node to print." << endl;
return;
}
if(head->next=NULL) {
cout << head->data << endl;
return;
} else {
Node* temp=head;
head=temp->next;
reversePrint(head);
cout << temp->data << endl;
return;
}
}
☆─────────────────────────────────────☆
speeddy (Wade) 于 (Sat Jun 4 20:30:33 2011, 美东) 提到:
.....
did not look into detail, but the first look find that
head = NULL...

☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 4 20:49:01 2011, 美东) 提到:
You are right. Thanks. The old == versus = problem.
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 4 20:54:13 2011, 美东) 提到:
发现不定义新节点也没问题。
void reversePrint(Node* head) {
if(head==NULL) {
cout << "Empty List. No node to print." << endl;
return;
}
if(head->next==NULL) {
cout << head->data << endl;
return;
} else {
reversePrint(head->next);
cout << head->data << endl;
return;
}
}
☆─────────────────────────────────────☆
city (city) 于 (Sat Jun 4 20:54:44 2011, 美东) 提到:
你这Q+数字玩的是什么啊
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 4 21:51:43 2011, 美东) 提到:
开始是 Brainbench 的练习题。后来加的就是我自己想问的题目了,或者是面试题,或
者是我自己遇到的问题。
☆─────────────────────────────────────☆
RayCai (菜菜) 于 (Mon Jun 6 16:14:26 2011, 美东) 提到:
Only the last one will be printed.
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 11 11:59:06 2011, 美东) 提到:
Did you try it? I tried it. It printed all.
☆─────────────────────────────────────☆
timzheng (zmit) 于 (Sat Jun 11 15:06:08 2011, 美东) 提到:
"Empty List. No node to print"
That will always be printed out first.
☆─────────────────────────────────────☆
timzheng (zmit) 于 (Sat Jun 11 15:08:51 2011, 美东) 提到:
Actually no. This won't happen. But it's better to have this out of the
recursion.
☆─────────────────────────────────────☆
done (done) 于 (Sat Jun 11 15:22:00 2011, 美东) 提到:
你发现有什么错?感觉没什么错误.
但如果说以整个code来看,其实后面两个return是多余的,可删去,另外print的message
有bug,head是空就说是empty list,但因为用了递归,head->next为null时,不代表它是
empty list
手痒写了个,但没验证...
void reversePrint(Node * head){
if(!head){
cout << "the end ..." << endl; // print some message here if needed...
return;
}
reversePrint(head->next);
cout << head->data << endl;
}
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 11 17:18:21 2011, 美东) 提到:
use head==NULL, not head=NULL (this is always true).
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 11 20:15:06 2011, 美东) 提到:
你是对的。后面那两个return语句是多余的,因为程序会自然运行。
这个message应该没错。因为只有这个list为空时,这个message才会打印。否则第二个
return处理最终状态。
验证了一下,你是对的。并且你的处理终止状态比我的简单。
...
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 11 20:17:44 2011, 美东) 提到:
第二个return语句保证了message不会被打印,除非原来的list为空。
☆─────────────────────────────────────☆
done (done) 于 (Sat Jun 11 20:27:43 2011, 美东) 提到:
噢....谢谢,那你原来上面的return是有用的,我当时想的时候是把两个return去掉后才
觉得那个message有错.
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 11 20:47:22 2011, 美东) 提到:
完全不用return也是可以的。你的可以改成
void reversePrint(Node * head){
if(!head){
cout << "the end ..." << endl; // print some message here if needed...
} else {
reversePrint(head->next);
cout << head->data << endl;
}
}
我的可以改成
void reversePrint2(Node* head) {
if(head==NULL) {
cout << "Empty List. No node to print." << endl;
} else if(head->next==NULL) {
cout << head->data << " reversePrint2" << endl;
} else {
reversePrint2(head->next);
cout << head->data << " reversePrint2" << endl;
}
}
message
...
☆─────────────────────────────────────☆
speeddy (Wade) 于 (Sat Jun 11 21:14:04 2011, 美东) 提到:
Done's code is better.
void reversePrint(Node * head){
if(!head){
cout << "the end ..." << endl; // print some message here if needed..
.
} else {
reversePrint(head->next);
cout << head->data << endl;
}
}
Suppose you write this function and this function is very very long. Also, m
aybe there are a lot of #ifdef, #endif inside this function to support multi
ple platform. People look at this kind of code often get loss.
Then later on, another engineer jump in and modify this function by adding c
ode behind here:
} else {
reversePrint(head->next);
cout << head->data << endl;
}
/*****************/
add code here
/*****************/
}
But he did not pay attention to the code you write previously as the functio
n is so big. Normally, it should just return when the head is NULL. But now
it continue excuting without return.....Bug happens then.
...
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sat Jun 11 21:26:46 2011, 美东) 提到:
I agree. It is better to use return than to use if else.
..
☆─────────────────────────────────────☆
lipingwu (ping) 于 (Sun Jun 12 14:19:09 2011, 美东) 提到:
It should work, but just is not very simple. We may be try following more
simple codes:
void reversePrint(Node *head){
if(head == NULL) return;
reversePrint(head->next);
cout << head->data << "\t";
}
☆─────────────────────────────────────☆
careerchange (Stupid) 于 (Sun Jun 12 15:18:45 2011, 美东) 提到:
It is the same as done's.
avatar
d*a
2
姑娘学了三年钢琴,现在提出要学小提琴,
啥牌子的好?啥档次的?
昨天老师给量了,要1/2的。谢谢。
avatar
m*k
3
renting is an option

【在 d*****a 的大作中提到】
: 姑娘学了三年钢琴,现在提出要学小提琴,
: 啥牌子的好?啥档次的?
: 昨天老师给量了,要1/2的。谢谢。

avatar
r*f
4
嗯,期待耳朵的考验

【在 m**k 的大作中提到】
: renting is an option
avatar
d*a
5
我看了也不贵,租的一个月也得不少钱吧。

【在 m**k 的大作中提到】
: renting is an option
avatar
d*a
6
已经听了很多这样的劝诫了,据说好一点的琴声音会好听点?
文盲瞎说的,别笑哦

【在 r*f 的大作中提到】
: 嗯,期待耳朵的考验
avatar
d*a
7
看了你的帖去查了,租个琴俩月70刀,还不如买了。
昨天老师说一百刀的就很好用了。
好歹咱这一学期上下来6个月呢,
实在一学期完了丫头要是不想学了咱还可以卖或者捐,应该比租合算吧。:)
ANYWAY,谢谢你的提议,以前受教过,很有用,很感谢。

【在 m**k 的大作中提到】
: renting is an option
avatar
h*r
8
租的好处是有保险,不怕坏,而且一般都免费送课本。
买个100刀的琴,能不能坚持用一年可不好说。
质量差的琴容易裂,弦弹性差,弓子容易变形......

【在 d*****a 的大作中提到】
: 看了你的帖去查了,租个琴俩月70刀,还不如买了。
: 昨天老师说一百刀的就很好用了。
: 好歹咱这一学期上下来6个月呢,
: 实在一学期完了丫头要是不想学了咱还可以卖或者捐,应该比租合算吧。:)
: ANYWAY,谢谢你的提议,以前受教过,很有用,很感谢。

avatar
M*e
9
我是买了,就amazon上的starter violin, 实木的,horse hair bow, 据老师说质量还
行。
我是准备娃大了就把这1/10 size 的violin 挂墙上当娃的房间装饰。。。以前看过一
家人这么做,我觉得很cute...

【在 d*****a 的大作中提到】
: 看了你的帖去查了,租个琴俩月70刀,还不如买了。
: 昨天老师说一百刀的就很好用了。
: 好歹咱这一学期上下来6个月呢,
: 实在一学期完了丫头要是不想学了咱还可以卖或者捐,应该比租合算吧。:)
: ANYWAY,谢谢你的提议,以前受教过,很有用,很感谢。

avatar
d*a
10
1/10?还有这么小的?得多大娃用啊?
买了,听你的,要不就当装饰好了。:)
家有俩宝,大的不学以后还有小的呢,实在不行我自己学。嘻嘻

【在 M******e 的大作中提到】
: 我是买了,就amazon上的starter violin, 实木的,horse hair bow, 据老师说质量还
: 行。
: 我是准备娃大了就把这1/10 size 的violin 挂墙上当娃的房间装饰。。。以前看过一
: 家人这么做,我觉得很cute...

avatar
m*k
11
1/16 i guess.小提琴可以很贵也能很便宜
avatar
d*a
12
还有1/16??玩具么?
我买了60多的。:)

【在 m**k 的大作中提到】
: 1/16 i guess.小提琴可以很贵也能很便宜
avatar
M*e
13
希望你喜欢你的新小提琴。
对了,1/10并不是full size 的1/10大小噢。。

【在 d*****a 的大作中提到】
: 1/10?还有这么小的?得多大娃用啊?
: 买了,听你的,要不就当装饰好了。:)
: 家有俩宝,大的不学以后还有小的呢,实在不行我自己学。嘻嘻

avatar
W*e
14
就买个普通练习琴就行了,如果能回国就在淘宝上买一个,5,600块能买个挺不错的。
avatar
t*g
15
1/2买起来可以用好久了。就是自己维护起来麻烦。档次要看老师要求吧。

【在 d*****a 的大作中提到】
: 姑娘学了三年钢琴,现在提出要学小提琴,
: 啥牌子的好?啥档次的?
: 昨天老师给量了,要1/2的。谢谢。

avatar
s*i
16
the smallest I have seen is 1/32.

【在 d*****a 的大作中提到】
: 还有1/16??玩具么?
: 我买了60多的。:)

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。