fix(guide): Fix all frontmatter
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
---
|
||||
title:Switch Statement
|
||||
title: Switch Statement
|
||||
---
|
||||
|
||||
A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each case.
|
||||
@ -12,7 +12,7 @@ switch(expression) {
|
||||
case constant-expression :
|
||||
statement(s);
|
||||
break; //optional
|
||||
|
||||
|
||||
// you can have any number of case statements.
|
||||
default : //Optional
|
||||
statement(s);
|
||||
@ -38,14 +38,14 @@ Example:
|
||||
```C++
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main () {
|
||||
// local variable declaration:
|
||||
char grade = 'D';
|
||||
|
||||
switch(grade) {
|
||||
case 'A' :
|
||||
cout << "Excellent!" << endl;
|
||||
cout << "Excellent!" << endl;
|
||||
break;
|
||||
case 'B' :
|
||||
case 'C' :
|
||||
@ -61,7 +61,7 @@ int main () {
|
||||
cout << "Invalid grade" << endl;
|
||||
}
|
||||
cout << "Your grade is " << grade << endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}```
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
title:While-loop
|
||||
title: While-loop
|
||||
---
|
||||
|
||||
A while loop statement repeatedly executes a target statement as long as a given condition is true.
|
||||
@ -18,7 +18,7 @@ Example:
|
||||
```C++
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main () {
|
||||
// Local variable declaration:
|
||||
int a = 10;
|
||||
@ -28,7 +28,7 @@ int main () {
|
||||
cout << "value of a: " << a << endl;
|
||||
a++;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user