Changed a = a + 1 to a++ (#28742)

Changed a = a + 1 to a++ in implementation section.  It is best practice to use a++ rather than a = a + 1
This commit is contained in:
toakes59
2019-03-17 12:45:59 -04:00
committed by Christopher McCormack
parent b8b1e029db
commit b4044fe267

View File

@@ -66,8 +66,7 @@ using std::endl;
int main () {
// for loop execution
for( int a = 10; a < 20; a = a + 1 )
{ // The loop will run till the value of a is less than 20
for( int a = 10; a < 20; a++ ) { // The loop will run till the value of a is less than 20
cout << "value of a: " << a << endl;
}
@@ -99,7 +98,7 @@ The body of the for loop need not be enclosed in braces if the loop iterates ove
int main () {
// Single line for loop
for( int a = 10; a < 20; a = a + 1 )
for( int a = 10; a < 20; a++ )
cout << "value of a: " << a << endl;