C ++到C的翻译问题 [英] C++ to C translation problem
问题描述
大家好,
我是初学者,我需要一些帮助。我必须使用堆栈制作RPN(后缀)计算器,这是由C中的单链表实现的。现在我发现但是在C ++中我无法将其转换为C.你能帮我把事情搞定吗?我从http://www.mediafire.com/view/q833x5sic8eq4sx/from_c__.txt开始,并使用http://www.mediafire.com/view/ewz9so6999ig5x0/using_c.txt中的一些代码我得到http:/ /www.mediafire.com/view/qesca0cg0vzjzac/to_this_in_c.txt代码和它调试但是当我在控制台中输入任何内容时它会崩溃并给我一些汇编代码我正在使用VS C ++ 2010.请帮我解决这个问题,我可以找不到什么。
Hi everyone,
I'm beginner and I need a little help. I have to make RPN (postfix) calculator using stack which is implemented by singly linked list in C. Now I found that but in C++ and I'm having trouble translating it to C. Can you help me getting things to work? I have started from http://www.mediafire.com/view/q833x5sic8eq4sx/from_c__.txt and using a little code from http://www.mediafire.com/view/ewz9so6999ig5x0/using_c.txt I get to http://www.mediafire.com/view/qesca0cg0vzjzac/to_this_in_c.txt code and it debugs but when I enter anything in console it crashes and gives me some assembly code I'm using VS C++ 2010. Please help me to fix this, I can't find what's wrong.
推荐答案
正如谢尔盖所说,当你试图学习另一种语言时,不要用一种语言复制代码。
你已经注意到,你最终会陷入转换混乱。
你最好尝试在C中找到例子并从那里开始。
如果您的第一个障碍是链接列表,您可以查看以下网站:
g / en / Linked_liststarget =_ blanktitle =New Window> ^ ]
第15课:单独联系李C中的sts [ ^ ] < br $> b $ b
C中的链接列表 [ ^ ]
$ b $祝你好运。
As Sergey said, don't copy code from one language when you are trying to learn another.
You will end up in a conversion mess, as you already noticed.
It is better you try to find examples in C and go from there.
If your first obstacle is a linked list, you can take a look at the following sites:
g/en/Linked_lists" target="_blank" title="New Window">^]
Lesson 15: Singly linked lists in C[^]
Linked lists in C[^]
Good luck.
这篇关于C ++到C的翻译问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!