📄 treeuse.m
字号:
// Use the Tree definitionwith treedef;// Define a function Sum that computes the sum// of the values of a all nodes of a given Tree tint Sum (Tree t){ match t { rule node(v, l, r) : return v + Sum(l) + Sum(r); rule empty() : return 0; }}// The main functionextern "C" void printf(...);main (){ Tree ExampleTree = node(11, empty(), node(22, empty(), empty())); printf ("Sum of ExampleTree is %d\n", Sum(ExampleTree));}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -