整理时间:2020-05-30
目录
1. C风格的hello world
2. C++风格的hello world
3. 总结
正文
1. C风格的hello world
#include <stdio.h>
int main()
{
printf("Hello, world!\n");
return 0;
}
2. C++风格的hello world‘
(1)example 1
#include <iostream>
//using namespace std;
int main()
{
std::cout << "Hello, world!" << "\n";
std::cout << "Hello, world!" << std::endl;
return 0;
}
(2)example 2
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, world!" << "\n";
cout << "Hello, world!" << endl;
return 0;
}
3. 总结
C++比C语言多的新概念
namespace
iostream
endl
THE END~