贝尔实验室推出: C with classed
→
\to
→ C++
(特点是 Garbage Collection 即垃圾回收需要手动考虑,但是注重性能)
- C (.c) 和 C++ (.cpp) 最大的区别就是前者面向过程,后者面向对象(且有更多开箱即用功能STL)
#include <iostream>
#include <stdio.h>
/*
How to print hello world ~
*/
int main(int argc, char** argv) // 第一个参数argc表示参数个数,
{ // 第二个参数argv是参数组
int a = 0
int b = 0
// 输入:
scanf("%d, %d", &a, &b);
std::cin >> a >> b; // using namespace std
// 输出:
printf("Hello World! ** %d %d ** This is C Style\n", a, b);
std::cout << "Hello World! This is C++ Style\n" << a << b << std::endl; // using namespace std
system("pause"); //system("cls") 清屏
return 0;
}
- 输出
cout << 输出内容与输入cin >> 接收变量.
C++与C对比详解
1647

被折叠的 条评论
为什么被折叠?



