Skip to content

Commit bb6f51b

Browse files
authored
Make the example about top() much more clear
Updated the stack example to push the value 3 instead of 2 avoid ambiguity and modified the output messages accordingly.
1 parent 9e35abf commit bb6f51b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

docs/standard-library/stack-class.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,21 +377,21 @@ int main( )
377377
stack <int> s1;
378378

379379
s1.push( 1 );
380-
s1.push( 2 );
380+
s1.push( 3 );
381381

382382
int& i = s1.top( );
383383
const int& ii = s1.top( );
384384

385385
cout << "The top integer of the stack s1 is "
386386
<< i << "." << endl;
387387
i--;
388-
cout << "The next integer down is "<< ii << "." << endl;
388+
cout << "The updated top integer is "<< ii << "." << endl;
389389
}
390390
```
391391
392392
```Output
393-
The top integer of the stack s1 is 2.
394-
The next integer down is 1.
393+
The top integer of the stack s1 is 3.
394+
The updated top integer is 2.
395395
```
396396

397397
## <a name="value_type"></a> `value_type`

0 commit comments

Comments
 (0)