ch1-Hello

Chapter_1 Square







Hello.cpp     TCP, p. 3


// import std; // not yet standard
#include <iostream> // for cout, endl declarations
// using std::cout, std::endl; // warning: use -std=c++17 or -std=gnu++17
using std::cout; // write cout instead of std::cout
using std::endl; // write endl instead of std::endl
// using namespace std; // use cout, endl, everything from std

int main() // int main(void)
{
// cout << "Hello, world!\n"; // both '\n', endl flush output buffer
cout << "Hello, world!" << endl;
// std::cout << "Hello, world!" << std::endl; // works (with)out `using'

// return 0; // not mandatory
}
/*
g++ Hello.cpp -o Hello -std=c++17
g++ Hello.cpp -o Hello -std=gnu++17

g++ Hello.cpp -o Hello

./Hello
Hello, world!
*/









Chapter_1 BACK_TO_TOP Square



Comments

Popular posts from this blog

Contents