Skip to content

Commit 2e8330e

Browse files
committed
introduce new graphic
1 parent 97b95b7 commit 2e8330e

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed
Loading
Loading
Loading
Loading

docs/get-started/tutorial-console-cpp.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Now let's modify the code in this template to be a calculator app.
130130
131131
1. To save the file, press **Ctrl+S**, or select the floppy disk icon in the toolbar under the menu bar.
132132

133-
1. To run the application, press **Ctrl+F5** or go to the **Debug** menu and select **Start Without Debugging**. You should see a console window appear that displays the text specified in the code.
133+
1. To run the application, press **Ctrl+F5** or go to the **Debug** menu and select **Start Without Debugging**. You should see a console window appear that looks like this.
134134

135135
1. Close the console window when you're done.
136136

@@ -323,7 +323,13 @@ You can also hover over variables in the code to see their current values at the
323323

324324
1. 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.
325325

326-
The program is doing what's 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. Its value is `inf`, which doesn't look right. 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:
326+
The program is doing what's 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. Its value is `inf`, which doesn't look right.
327+
328+
:::image type="complex" source="./media/calc-vs2022-debug-inf.png" alt-text="Screenshot of debugging the calculator".:::
329+
The current statement in the debugger is cout << "Result is: " << result << endl; In the autos window, result is inf.
330+
:::image-end:::
331+
332+
Let's fix it. The `cout` line outputs whatever value is stored in `result`, so when you step one more line forward using **F10**, the console window displays:
327333

328334
:::image type="complex" source="./media/calc-divide-by-zero-fail.png" alt-text="Screenshot of the Visual Studio Debug Console displaying the result of a division by zero operation.":::
329335
The app outputs: Please enter the operation to perform. Format: a+b | a-b | a*b | a/b. The user entered 5-0. The app output: Result is: 5. The user entered 10/0. The app output: Result is: inf
@@ -534,7 +540,9 @@ A class is like a blueprint for an object that does something. In this case, we
534540

535541
1. Go to the **Project** menu and select **Add Class**. In the **Class Name** edit box, enter *Calculator*. Select **OK**.
536542

537-
:::image type="content" source="./media/calc-vs2017-create-calculator-class.png" alt-text="Video showing the user opening the Add Class dialog box, typing 'Calculator' in the Class Name field, and clicking OK.":::
543+
:::image type="complex" source="./media/calc-vs2017-create-calculator-class.png" alt-text="Screenshot of the Visual Studio Add Class dialog box.":::
544+
The class name field contains the text calculator. The .h file field contains Calculator.h. The .cpp file field contains Calculator.cpp. The base class field is empty. The options for inline, and Managed are unchecked.
545+
:::image-end:::
538546

539547
A class is like a blueprint for an object that does something. In this case, we define a calculator and how it should work.
540548

@@ -710,7 +718,13 @@ You can also hover over variables in the code itself to see their current values
710718

711719
1. 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.
712720

713-
The program is doing what's 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. Its value is `inf`, which doesn't look right. 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:
721+
The program is doing what's 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. Its value is `inf`, which doesn't look right.
722+
723+
:::image type="complex" source="./media/calc-vs2017-debug-inf.png" alt-text="Screenshot of debugging the calculator".:::
724+
The current statement in the debugger is cout << "Result is: " << result << endl; In the autos window, result is inf.
725+
:::image-end:::
726+
727+
Let's fix it. The `cout` line outputs whatever value is stored in `result`, so when you step one more line forward using **F10**, the console window displays:
714728

715729
:::image type="complex" source="./media/calc-divide-by-zero-fail.png" alt-text="Screenshot of the Visual Studio Debug Console displaying the result of a division by zero operation.":::
716730
The app outputs: Please enter the operation to perform. Format: a+b | a-b | a*b | a/b. The user entered 5-0. The app output: Result is: 5. The user entered 10/0. The app output: Result is: inf

0 commit comments

Comments
 (0)