Skip to content

Commit fd6c214

Browse files
TylerMSFTTylerMSFT
authored andcommitted
missed edit
1 parent 8be0c54 commit fd6c214

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The usual starting point for a C++ programmer is a "Hello, world!" application t
1919

2020
## Create your app project
2121

22-
Visual Studio uses *projects* to organize the code for an app, and *solutions* to organize the project(s). A project contains all the options, configurations, and rules used to build an app. It also manages the relationship between all the project's files and any external files. To create your app, first, create a new project and solution.
22+
Visual Studio uses *projects* to organize the code for an app, and *solutions* to organize one or more projects. A project contains all the options, configurations, and rules used to build an app. It also manages the relationship between all the project's files and any external files. To create your app, first, create a new project and solution.
2323

2424
1. Start Visual Studio--the Visual Studio Start dialog box appears. Select **Create a new project** to get started.
2525

@@ -146,7 +146,7 @@ A class is like a blueprint for an object that does something. In this case, we
146146

147147
Two new files get added to your project. To save all your changed files at once, press **Ctrl+Shift+S**. It's a keyboard shortcut for **File** > **Save All**. There's also a toolbar button for **Save All**, an icon of two floppy disks, found beside the **Save** button. In general, it's good practice to do **Save All** frequently, so you don't miss any files when you save.
148148

149-
The **Add Class** wizard you used previously created `.h` and `.cpp` files that have the same name as the class. You can see a full list of your project files in the **Solution Explorer** window, visible on the side of the IDE. If the window isn't visible, you can open it from the menu bar: select **View** > **Solution Explorer**.
149+
The **Add Class** wizard creates `.h` and `.cpp` files that have the same name as the class. You can see a full list of your project files in the **Solution Explorer** window, visible on the side of the IDE. If the window isn't visible, you can open it from the menu bar: select **View** > **Solution Explorer**.
150150

151151
:::image type="complex" source="./media/calc-vs2019-solution-explorer.png" alt-text="Screenshot of the Visual Studio Solution Explorer window.":::
152152
The calculator tutorial project has a header files node containing Calculator.h. A Source Files node contains Calculator.cpp and CalculatorTutorial.cpp. Nodes for references, external dependencies, and resource files are visible but closed.
@@ -171,7 +171,7 @@ A class is like a blueprint for an object that does something. In this case, we
171171
> - C++ code is organized into *header* (`.h`) files and *source* (`.cpp`) files. Several other file extensions are supported by various compilers, but these are the main ones to know about. Functions and variables are normally *declared*, that is, given a name and a type, in header files, and *implemented*, or given a definition, in source files. To access code defined in another file, you can use `#include "filename.h"`, where `filename.h` is the name of the file that declares the variables or functions you want to use.
172172
> - It's good practice to organize your code into different files based on what it does, so it's easy to find the code you need later. In our case, we define the `Calculator` class separately from the file containing the `main()` function, but we plan to reference the `Calculator` class in `main()`.
173173
174-
1. A green squiggle appears under `Calculate` because although the `Calculate` function has been *declared*, it hasn't been *defined*. Hover over `Calculate`, click the down arrow on the screwdriver that appears, and select **Create definition of 'Calculate' in `Calculator.cpp`**.
174+
1. A green squiggle appears under `Calculate` because although the `Calculate` function is *declared*, it isn't *defined*. Hover over `Calculate`, click the down arrow on the screwdriver that appears, and select **Create definition of 'Calculate' in `Calculator.cpp`**.
175175

176176
:::image type="content" source="./media/calc-vs2019-create-definition.png" alt-text="Screenshot of a screwdriver dropdown in the Visual Studio editor window. The option 'Create definition of Calculate in Calculator.cpp' is highlighted.":::
177177

@@ -213,7 +213,7 @@ A class is like a blueprint for an object that does something. In this case, we
213213
214214
If you build and run the code again at this point, it will immediately exit after asking which operation to perform. So, modify the `main` function to do multiple calculations.
215215

216-
### To call the `Calculator` class member functions
216+
### Call the `Calculator` class member functions
217217

218218
1. Update the `main` function in *`CalculatorTutorial.cpp`* as follows:
219219

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

322322
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.
323323

324-
It looks like 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 `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:
324+
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 `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:
325325

326326
:::image type="complex" source="./media/calc-vs2019-divide-by-zero-fail.png" alt-text="Screenshot of the Visual Studio Debug Console displaying the result of a division by zero operation.":::
327327
The app output: 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
@@ -400,7 +400,7 @@ Let's handle division by zero more gracefully so that it's easier for the user t
400400

401401
## The finished app
402402

403-
Congratulations! You've completed the code for the calculator app, built and debugged it, and added it to a repo, all in Visual Studio.
403+
Congratulations! You completed the code for the calculator app, built and debugged it, and added it to a repo, all in Visual Studio.
404404

405405
## Next steps
406406

@@ -410,15 +410,15 @@ Congratulations! You've completed the code for the calculator app, built and deb
410410

411411
::: moniker range="<msvc-160"
412412

413-
The usual starting point for a C++ programmer is a "Hello, world!" application that runs on the command line. You'll start with that in this article, and then we move on to something more challenging: a calculator app.
413+
The usual starting point for a C++ programmer is a "Hello, world!" application that runs on the command line. You start with that in this article, and then we move on to something more challenging: a calculator app.
414414

415415
## Prerequisites
416416

417417
- Visual Studio with the **Desktop development with C++** workload installed and running on your computer. To install it, see [Install C++ support in Visual Studio](../build/vscpp-step-0-installation.md).
418418

419419
## Create your app project
420420

421-
Visual Studio uses *projects* to organize the code for an app, and *solutions* to organize the project(s). A project contains all the options, configurations, and rules used to build an app. It also manages the relationship between all the project's files and any external files. To create your app, first, create a new project and solution.
421+
Visual Studio uses *projects* to organize the code for an app, and *solutions* to organize one or more projects. A project contains all the options, configurations, and rules used to build an app. It also manages the relationship between all the project's files and any external files. To create your app, first, create a new project and solution.
422422

423423
1. On the menubar in Visual Studio, select **File** > **New** > **Project**. The **New Project** window opens.
424424
2. On the left sidebar, make sure **Visual C++** is selected. In the center, select **Windows Console Application**.
@@ -562,7 +562,7 @@ A class is like a blueprint for an object that does something. In this case, we
562562
> - C++ code is organized into *header* (`.h`) files and *source* (`.cpp`) files. Several other file extensions are supported by various compilers, but these are the main ones to know about. Functions and variables are normally *declared*, that is, given a name and a type, in header files, and *implemented*, or given a definition, in source files. To access code defined in another file, you can use `#include "filename.h"`, where `filename.h` is the name of the file that declares the variables or functions you want to use.
563563
> - It's good practice to organize your code into different files based on what it does, so it's easy to find the code you need later. In our case, we define the `Calculator` class separately from the file containing the `main()` function, but we plan to reference the `Calculator` class in `main()`.
564564
565-
1. A green squiggle appears under `Calculate` because although the `Calculate` function has been *declared*, it hasn't been *defined*. Hover over `Calculate`, click the down arrow on the screwdriver that appears, and select **Create definition of 'Calculate' in `Calculator.cpp`**. A pop-up appears that gives you a peek of the code change that was made in the other file. The code was added to *`Calculator.cpp`*.
565+
1. A green squiggle appears under `Calculate` because although the `Calculate` function is *declared*, it isn't *defined*. Hover over `Calculate`, click the down arrow on the screwdriver that appears, and select **Create definition of 'Calculate' in `Calculator.cpp`**. A pop-up appears that gives you a peek of the code change that was made in the other file. The code was added to *`Calculator.cpp`*.
566566

567567
:::image type="content" source="./media/calculator-create-definition.gif" alt-text="Video showing using the light bulb dropdown to select Create definition of Calculate in Calculator.cpp.":::
568568

@@ -600,7 +600,7 @@ A class is like a blueprint for an object that does something. In this case, we
600600
601601
If you build and run the code again at this point, it will still exit after asking which operation to perform. Next, modify the `main` function to do some calculations.
602602

603-
### To call the Calculator class member functions
603+
### Call the Calculator class member functions
604604

605605
1. Now let's update the `main` function in *`CalculatorTutorial.cpp`*:
606606

@@ -711,7 +711,7 @@ You can also hover over variables in the code itself to see their current values
711711
Each line of code in the Calculate function is stepped over until control returns to the main function. The user then hovers over the variable named result to see its value, which is: inf."
712712
:::image-end:::
713713

714-
It looks like 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, 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:
714+
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, 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:
715715

716716
:::image type="complex" source="./media/calculator-divide-by-zero-fail.png" alt-text="Screenshot of the Visual Studio Debug Console displaying the result of a division by zero operation.":::
717717
The app output: 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)