Almost everyone who has just learned a programming language will write a hello world Procedure of .
c++ It's a complex language , So there are many different ways to do the same thing , We will not discuss whether this is a good phenomenon or a bad one . method 1
: original c Methods and classic c++ method #include <cstdio> #include <iostream> using namespace std; int
main() {printf("Hello world"); puts("Hello world"); cout << "Hello world" <<
endl;return 0; } method 2: Using macros to print Hello world #include <cstdio> #define
saySomething(sth) puts(#sth) int main() { return saySomething(Hello world); }
method3: Using iterators iterator To achieve output #include <iostream> #include <string> #include
<iterator> #include <algorithm> int main() { std::string str("Hello world"); std
::copy(std::begin(str),std::end(str), std::ostream_iterator<char>(std::cout, ""
));return 0; } method 4: Using file name macro to realize Hello world The key is to name the source code file Hello world.cpp
#include <string> #include <iostream> int main() { std::string
fileName(__FILE__);std::cout << fileName.substr(0, fileName.find("."))<< std
::endl;return 0; }
To be continued ...

Technology
©2019-2020 Toolsou All rights reserved,
JAVA Detailed explanation of anomalies MySQL An interview is a must ! How to use it quickly html and css Write static page R Language cluster analysis case Dialogue between apple and Nissan suspended ,Apple Car How's it going ?java Realize the function of grabbing red packets SpringBoot practice ( five ):mybatis-plus In BaseMapper,Iservice and ServiceImpl Google says home office affects work efficiency !2021 Return to offline office in 2010 about keras use fit_generator Encountered in StopIteration Programmer Tanabata Valentine's Day confession code