大家好,这是我在CSDN的第一篇文章
初步开始c++语言的学习
从C语言到C++语言有着很多相似行,也有一些不同。
下面来介绍一下一些简单的不同点:
1,头文件的不同 C风格是#include<stdio.h> 而 C++风格头文件是# include <iostream>
2,c++中要使用 using namespce std ;
3,C++中的右移运算符 << 和 左移运算符 >>
4,c++中输入和输出 cout cin
4,打印操作的不同 c风格 printf(" ") 而C++风格打印 cout<<" "
# include <iostream>//头文件 注意是<iostream>
int main()
{
using namespace std;//编译指令
cout << "come up and c++ me some time.";// cout 标准输出 注意格式 cout << "语句"; 相当于 printf(""); <<插入运算符; " 字符串" cout << endl;//<< endl 结束输出且换行
cout << "You won't regret it!"<< endl; //<< endl 结束输出且换行
return 0;
}
总结自---c++ primer plus