From 70d8675171e37aa36626f263d06950c57f826403 Mon Sep 17 00:00:00 2001 From: jlewismith <36462205+jlewismith@users.noreply.github.com> Date: Mon, 5 Nov 2018 02:07:32 -0700 Subject: [PATCH] Fixed several typos. (#21699) --- guide/english/cplusplus/loops/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/guide/english/cplusplus/loops/index.md b/guide/english/cplusplus/loops/index.md index f9eef1121db..a63a6bc008e 100644 --- a/guide/english/cplusplus/loops/index.md +++ b/guide/english/cplusplus/loops/index.md @@ -6,7 +6,7 @@ title: Loops ## Introduction -Now lets discuss something known as loop. Suppose you want to print the even numbers from 1 to 1000 on the screen. One way +Now let's discuss something known as loop. Suppose you want to print the even numbers from 1 to 1000 on the screen. One way to do this is to write the following lines ``` c++ @@ -27,7 +27,7 @@ There are different types of loop functions: ### While and do while loops While and do while loops allow you to run the loop until a condition finishes. -The difference between While and Do while is that Do while loop always executes atleast once. +The difference between While and Do while is that Do while loop always executes at least once. The very use of Do while loop can be seen in the scenarios when the number of times that the loop will run depends upon the first iteration of the loop. Here you can see an example: ``` c++ @@ -50,7 +50,7 @@ for ( initialize a variable; check a condition; increment the initialized variab } ``` -Lets write a program which will print numbers from 0 to 1000 including 1000 on the screen using a for loop. +Let's write a program which will print numbers from 0 to 1000 including 1000 on the screen using a for loop. ``` c++ for (int i = 0;i<=1000;i++) @@ -60,13 +60,13 @@ for (int i = 0;i<=1000;i++) ``` When you execute this code in a c++ program numbers from 1 to 1000 will be printed. -Now lets discuss how the for loop works. +Now let's discuss how the for loop works. * You start a for loop by typing the keyword 'for'. It means you are starting a for loop ` for ` * Next you open and close a round bracket. In this brackets you write some conditions which will be discussed later ` for()` -* Inside the brackets first you write the initial condition i.e the value from where the loop will start. Like in the +* Inside the brackets first you write the initial condition i.e. the value from where the loop will start. Like in the above program we write int i = 0 ` for(int i = 0)` * Then you write the semicolon and then condition until when the loop will be executed. In the above code you define @@ -96,7 +96,7 @@ for (int i = 0;i<=1000;i=i+2) } ``` -* The difference in first program and second is the increment part. Rest of code is same. This program will print 0 and +* The difference between the first program and second is the increment part. The rest of the code is the same. This program will print 0 and then add 2 to it and print 2 on console and so on upto value of i becomes equal to 1000. Our final program to print even numbers from 0 to 1000 will look like this.