This should be a comment, but my rep seems to be too low. How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 7 years, 9 months ago.
Active 7 years, 9 months ago. Viewed times. To debug the program, press F5 , or choose the Local Windows Debugger toolbar button that has the green arrow icon. In your console app, if you enter something like "5 - 0", the program behaves normally and keeps running. You can even put any number of spaces between the operator and numbers: cin is smart enough to parse the input appropriately.
Whenever you debug your code, you may notice that some new windows appear. These windows can assist your debugging experience. Take a look at the Autos window. The Autos window shows you the current values of variables used at least three lines before and up to the current line. To see all of the variables from that function, switch to the Locals window. You can actually modify the values of these variables while debugging, to see what effect they would have on the program.
In this case, we'll leave them alone. You can also just hover over variables in the code itself to see their current values where the execution is currently paused.
Make sure the editor window is in focus by clicking on it first. The yellow line on the left shows the current point of execution. The current line calls Calculate , so press F11 to Step Into the function.
You'll find yourself in the body of the Calculate function. Be careful with Step Into ; if you do it too much, you may waste a lot of time. It goes into any code you use on the line you are on, including standard library functions. Now that the point of execution is at the start of the Calculate function, press F10 to move to the next line in the program's execution. F10 is also known as Step Over.
You can use Step Over to move from line to line, without delving into the details of what is occurring in each part of the line. In general you should use Step Over instead of Step Into , unless you want to dive more deeply into code that is being called from elsewhere as you did to reach the body of Calculate. Continue using F10 to Step Over each line until you get back to the main function in the other file, and stop on the cout line.
It looks like the program is doing what is expected: it takes the first number, and divides it by the second. On the cout line, hover over the result variable or take a look at result in the Autos window. You'll see its value is listed as "inf", which doesn't look right, so let's fix it. The cout line just outputs whatever value is stored in result , so when you step one more line forward using F10 , the console window displays:. This result happens because division by zero is undefined, so the program doesn't have a numerical answer to the requested operation.
Make the following changes in CalculatorTutorial. You can leave the program running as you edit, thanks to a debugger feature called Edit and Continue :. Now press F5 once. Program execution continues all the way until it has to pause to ask for user input. Now, a more helpful message is printed.
The user is asked for more input, and the program continues executing normally. When you edit code while in debugging mode, there is a risk of code becoming stale. This happens when the debugger is still running your old code, and has not yet updated it with your changes. The debugger pops up a dialog to inform you when this happens. Sometimes, you may need to press F5 to refresh the code being executed. In particular, if you make a change inside a function while the point of execution is inside that function, you'll need to step out of the function, then back into it again to get the updated code.
If that doesn't work for some reason and you see an error message, you can stop debugging by clicking on the red square in the toolbar under the menus at the top of the IDE, then start debugging again by entering F5 or by choosing the green "play" arrow beside the stop button on the toolbar.
Now that you've created an app, you might want to add it to a Git repository. We've got you covered. Git is the most widely used modern version control system, so whether you're a professional developer or you're learning how to code, Git can be very useful. There, you can find cheat sheets, a popular online book, and Git Basics videos. To associate your code with Git, you start by creating a new Git repository where your code is located.
Here's how:. The repository name auto-populates based on your folder location. By default, your new repository is private, which means you're the only one who can access it.
Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services. Privacy policy. Thank you. Microsoft makes no warranties, express or implied, with respect to the information provided here. The URI specified as a String , from which to download data. The address parameter is null. The fileName parameter is null.
The DownloadFile method downloads to a local file data from the URI specified by in the address parameter. Brought to you by: nboulfroy. Get project updates , sponsored content from our select partners, and more. Full Name. Phone Number. Job Title. Company Size Company Size: 1 - 25 26 - 99 - - 1, - 4, 5, - 9, 10, - 19, 20, or More.
Get notifications on updates for this project. Get the SourceForge newsletter.
0コメント