Skip to content

Commit 7e5f22f

Browse files
committed
updates
1 parent 0f8e7b2 commit 7e5f22f

File tree

7 files changed

+38
-39
lines changed

7 files changed

+38
-39
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# ignore cache files for sample projects
22
.vscode/ipch
3-
browse*.db*
3+
browse*.db*
4+
*.obj
5+
*.pdb
6+
*.exe
7+
*.ilk

Code Samples/BoxConsoleSample/Objects/box.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22
#define BOX_H
33

44
/**
5-
* Box object
6-
* Defines Box and its properties
5+
* Definition of a box object with three dimensions.
76
*/
8-
struct Box {
9-
public:
10-
int length;
11-
int width;
12-
int height;
13-
14-
int volume(int length, int width, int height){
7+
struct box
8+
{
9+
int length;
10+
int width;
11+
int height;
12+
13+
int volume()
14+
{
1515
return length * width * height;
16-
}
16+
}
1717
};
1818

1919
#endif
20-
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# Box Sample
2-
This sample is a simple C++ program that takes console input (box dimensions) and computes their sum (box volume).
2+
This sample is a simple C++ program that computes and outputs the volume of a box.
33

44
We use this example in our blog posts to illustrate new extension features.
55

66
## Build and Debug Active File
7-
Available as of March 2019, "Build and Debug Active File" automatically configures the build tasks and kicks off a build and debug session.
7+
Available as of March 2019, "Build and Debug Active File" automatically configures the build tasks and kicks off a build and debug session. There are
8+
three ways to get started with this feature.
89

9-
### Context Menu
10-
While editing a file in a workspace folder, you can right click in the editor field and select the "Build and Debug Active File" context menu option.
11-
12-
![right click and select Build and Debug Active File](./Code Samples\BoxConsoleSample\build_debug_active_file.png)
10+
### Command
11+
While editing a file in your workspace folder, you can open the command palette and select the `C/C++: Build and Debug Active File` command.
12+
This option will generate a tasks.json file for you, build your active source file, and then launch the debugger.
1313

14-
Your tasks.json and launch.json files will be created and the project will build and launch the debugger mode.
14+
![Open command palette and select Build and Debug Active File](build_debug_command.png)
1515

16-
### Command
17-
Another way to begin building and debugging your active file is to execute the command by pressing "F5".
16+
### Context Menu
17+
While editing a file in a workspace folder, you can right click in the editor field and select the "Build and Debug Active File" context menu option.
18+
This option will generate a tasks.json file for you, build your active source file, and then launch the debugger.
1819

19-
Just like with the context menu, your tasks.json and launch.json files will be created and the project will build and launch the debugger mode.
20+
![Right click and select Build and Debug Active File](build_debug_context_menu.png)
2021

22+
### F5
23+
Another way to begin building and debugging your active file is to execute the command by pressing <kbd>F5</kbd>. This method will configure
24+
both a tasks.json and launch.json file for you, build your active source file, and then launch the debugger.
Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
#include <iostream>
22
#include "Objects/box.h"
3+
34
using namespace std;
45

56
/**
6-
* Main takes in Box dimensions
7-
* Calculates and prints Box volume
7+
* Calculate and print the volume of a box.
88
*/
9-
int main() {
10-
Box package;
11-
package.length = int{};
12-
cout << "Enter package length: \n" << std::flush;
13-
std::cin >> package.length;
14-
15-
package.width = int{};
16-
cout << "Enter package width: \n" << std::flush;
17-
std::cin >> package.width;
18-
19-
package.height = int{};
20-
cout << "Enter package height: \n" << std::flush;
21-
std::cin >> package.height;
22-
23-
cout << "Package volume is: " << package.volume(package.length, package.width, package.height) << endl;
9+
int main()
10+
{
11+
box package{ 10, 10, 10 };
12+
cout << "Package length: " << package.length << endl;
13+
cout << "Package width: " << package.width << endl;
14+
cout << "Package height: " << package.height << endl;
15+
cout << "Package volume: " << package.volume() << endl;
2416
}
-166 KB
Binary file not shown.
25.9 KB
Loading
33.1 KB
Loading

0 commit comments

Comments
 (0)