Sequence

This page is under construction. Please come back later.
In programming languages we have three ways to control the flow of statements: Sequence, Selection and Iteration. Sequence is the simplest and most basic flow control mechanism. It simply means that statements are executed sequentially in the order they appear in the program.
#undef NDEBUG
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char **argv) {
int x = 1;
cout << "x: " << x << endl;
x = 2;
cout << "x: " << x << endl;
x = 3;
cout << "x: " << x << endl;
return 0;
}
Output
$ g++ -std=c++17 Sequence1.cpp -o Sequence1 -lfmt
$ ./Sequence1
x: 1
x: 2
x: 3
Questions
- {{Who's on first?}}
- {{Who's on second?}}
- {{Who's on third?}}
Projects
More ★'s indicate higher difficulty level.
References
-
[[C++ Programming Language]], 4th Edition, Bjarne Stroustrup, Addison-Wesley, 2013, ISBN 978-0321563842.
- [[C++ Language Reference]]
- [[cplusplus.com]]
- [[Cprogramming.com]]
Pure Programmer


