I'm just being introduced to C++, and want to know a basic question.... What happens when using C++? Is there anywhere I can see a working example? Textbooks break it down, segment by segment. I would really like to SEE what happens. ANY suggestion would be appreciated. Hope MY question is not too vague. Thanks!
我只是被介绍给C ++,想知道一个基本问题......使用C ++会发生什么?有什么地方我能看到一个有效的例子吗?教科书逐段细分。我真的很想看看会发生什么。任何建议将不胜感激。希望我的问题不要太模糊。谢谢!
7 个解决方案
#1
You get into the office around 8:30am, get some tea, and you sit down and run a program called an IDE. It lets you type code with the keyboard, such as:
你早上8:30左右进入办公室,喝点茶,然后坐下来运行一个名为IDE的程序。它允许您使用键盘键入代码,例如:
(*m_pHopeThisIsntNull)->doIt();
You can then hit F5 and the code runs and you find out it doesn't work the way you expected. Pretty soon it's 5:30pm.
然后你可以点击F5并运行代码,你发现它不能按预期的方式工作。很快就到了下午5:30。
#2
If you are trying to learn C++, you cannot just read from the textbook -- programming is learned best through hands-on practice. You should get a C++ compiler and run through the textbook examples yourself.
如果您正在尝试学习C ++,那么您不能只阅读教科书 - 通过实践练习可以最好地学习编程。您应该获得一个C ++编译器并自己运行教科书示例。
#3
When I use C++, other programmers bow down to me because of my awesomeness. But that's just my experience.
当我使用C ++时,其他程序员因为我的精彩而屈服于我。但那只是我的经历。
#4
Sounds like a short session with your TA (at an American university, this is the graduate student who helps with the hands-on stuff, does the grading, etc., as a help to the professor) is in order. Get him/her to show you how to use whatever IDE (integrated development environment) your class is requiring/suggesting. Or wait for your lab session, where you will learn this.
听起来像是与TA的短暂会话(在美国大学,这是一个研究生,帮助实践的东西,评分等,作为对教授的帮助)是有序的。让他/她向您展示如何使用您的课程要求/建议的任何IDE(集成开发环境)。或者等待您的实验课程,在那里您将学到这一点。
#5
You can use a debugger to execute your program step by step, looking at the variables. If that's not enough, debuggers can also show you the a disassembled version of the machine code along with the processor's registers.
您可以使用调试器逐步执行程序,查看变量。如果这还不够,调试器还可以向您显示机器代码的反汇编版本以及处理器的寄存器。
Would that help?
那会有帮助吗?
#6
You are using C++! your browser is written in C++!
您正在使用C ++!您的浏览器是用C ++编写的!
#7
If you want to see it step by step:
如果你想逐步看到它:
Set a breakpoint at the first line and start in debug (F5 in Visual Studio). You can step through the program step-by-step and see what's going on with varying granularity (Step Over or Step Into - usually F10 and F11 in Visual Studio). Stepping into will follow a function call whereas F10 will call it, and step forward over it after it returns.
在第一行设置断点并在调试中启动(在Visual Studio中为F5)。您可以逐步完成该程序,并查看不同粒度的内容(Step Over或Step Into - 通常是Visual Studio中的F10和F11)。踏入将跟随函数调用,而F10将调用它,并在它返回后向前移动它。
If you want to see what's going on at a lower level you can use disassemble on your code.
如果您想查看较低级别的内容,可以在代码中使用反汇编。
I've used Visual Studio/Windows stuff here b/c that's what I'm most used to but these things are in every major C++ IDE I've seen.
我在这里使用了Visual Studio / Windows的东西b / c这是我最常用的东西,但这些东西都出现在我见过的每个主要的C ++ IDE中。
#1
You get into the office around 8:30am, get some tea, and you sit down and run a program called an IDE. It lets you type code with the keyboard, such as:
你早上8:30左右进入办公室,喝点茶,然后坐下来运行一个名为IDE的程序。它允许您使用键盘键入代码,例如:
(*m_pHopeThisIsntNull)->doIt();
You can then hit F5 and the code runs and you find out it doesn't work the way you expected. Pretty soon it's 5:30pm.
然后你可以点击F5并运行代码,你发现它不能按预期的方式工作。很快就到了下午5:30。
#2
If you are trying to learn C++, you cannot just read from the textbook -- programming is learned best through hands-on practice. You should get a C++ compiler and run through the textbook examples yourself.
如果您正在尝试学习C ++,那么您不能只阅读教科书 - 通过实践练习可以最好地学习编程。您应该获得一个C ++编译器并自己运行教科书示例。
#3
When I use C++, other programmers bow down to me because of my awesomeness. But that's just my experience.
当我使用C ++时,其他程序员因为我的精彩而屈服于我。但那只是我的经历。
#4
Sounds like a short session with your TA (at an American university, this is the graduate student who helps with the hands-on stuff, does the grading, etc., as a help to the professor) is in order. Get him/her to show you how to use whatever IDE (integrated development environment) your class is requiring/suggesting. Or wait for your lab session, where you will learn this.
听起来像是与TA的短暂会话(在美国大学,这是一个研究生,帮助实践的东西,评分等,作为对教授的帮助)是有序的。让他/她向您展示如何使用您的课程要求/建议的任何IDE(集成开发环境)。或者等待您的实验课程,在那里您将学到这一点。
#5
You can use a debugger to execute your program step by step, looking at the variables. If that's not enough, debuggers can also show you the a disassembled version of the machine code along with the processor's registers.
您可以使用调试器逐步执行程序,查看变量。如果这还不够,调试器还可以向您显示机器代码的反汇编版本以及处理器的寄存器。
Would that help?
那会有帮助吗?
#6
You are using C++! your browser is written in C++!
您正在使用C ++!您的浏览器是用C ++编写的!
#7
If you want to see it step by step:
如果你想逐步看到它:
Set a breakpoint at the first line and start in debug (F5 in Visual Studio). You can step through the program step-by-step and see what's going on with varying granularity (Step Over or Step Into - usually F10 and F11 in Visual Studio). Stepping into will follow a function call whereas F10 will call it, and step forward over it after it returns.
在第一行设置断点并在调试中启动(在Visual Studio中为F5)。您可以逐步完成该程序,并查看不同粒度的内容(Step Over或Step Into - 通常是Visual Studio中的F10和F11)。踏入将跟随函数调用,而F10将调用它,并在它返回后向前移动它。
If you want to see what's going on at a lower level you can use disassemble on your code.
如果您想查看较低级别的内容,可以在代码中使用反汇编。
I've used Visual Studio/Windows stuff here b/c that's what I'm most used to but these things are in every major C++ IDE I've seen.
我在这里使用了Visual Studio / Windows的东西b / c这是我最常用的东西,但这些东西都出现在我见过的每个主要的C ++ IDE中。