当前位置: 首页 > news >正文

Wordpress球队网站宠物交易网站模板

Wordpress球队网站,宠物交易网站模板,外贸网站建设网站优化,天津市住房和城乡建设厅网站C是如何工作的 文章目录 C是如何工作的1、新建Hello World工程1.1使用Visual Studio新建项目1.2 HelloWorld1.2.1 命名空间1.2.2 输出输出 1.3 注释1.4 函数1.4.1 使用有返回的函数1.4.2 自定义函数 1、新建Hello World工程 1.1使用Visual Studio新建项目 按照下面的图片是如何工作的 文章目录 C是如何工作的1、新建Hello World工程1.1使用Visual Studio新建项目1.2 HelloWorld1.2.1 命名空间1.2.2 输出输出 1.3 注释1.4 函数1.4.1 使用有返回的函数1.4.2 自定义函数 1、新建Hello World工程 1.1使用Visual Studio新建项目 按照下面的图片建立Main.cpp文件。 1.2 HelloWorld #include iostreamint main() {using namespace std;cout 你不能放弃。;cout endl;cout 开始学习C;return 0; }注意 #之后的为预处理命令 using namespace std; 编译指令 cout是一个输出 1.2.1 命名空间 上述代码可以写成如下模式 #include iostream //这里我的第一个C程序单行注释 using namespace std; int main() { /* 多行注释 */cout 你不能放弃。;cout endl;cout 开始学习C;return 0; }什么是命名空间为什么要写using namespace std;这句话呢 这是C新引入的一个机制主要是为了解决多个模块间命名冲突的问题就像现实生活中两个人重名一个道理。C把相同的名字都放到不同的空间里来防止名字的冲突。 例如标准C库提供的对象都存放在std这个标准名字空中比如cin、cout、endl所以我们会看到在C程序中都会有using namespace std;这句话了。 用域限定符::来逐个制定 #include iostream //这里我的第一个C程序单行注释 int main(){ std::cout 限定符书写 std::endl;return 0; }用using和域限定符一起制定用哪些名字 #include iostream //这里我的第一个C程序单行注释 using std::cout; using std::endl; int main(){ cout 限定符书写 endl;return 0; }1.2.2 输出输出 C中的输入输出流分别用cin和cout来表示使用之前需要以来标准库iostream即也要开头加一句#include 提到cout最常用到的还有endl操纵符可以直接将它插入到cout里起输出换行的效果。 cout输出的使用 cout可以连续输入。 本质上是将字符串Hello插入到cout对象里并以cout对象作为返回值返回因此你还可以用在后面连续输出多个内容 cout连续输出 #include iostream using namespace std; int main(){ cout hello world;return 0; }使用endl换行 #include iostream using namespace std; int main(){ cout Hello endl www.dotcpp.com endl;return 0; }cin输入流的使用 接收一个数据之前都要先定义一个与之类型一致的变量用来存放这个数据,然后利用cin搭配输入操作符来接收用户从键盘的输入 #include iostream using namespace std; int main(){ //cout Hello endl www.dotcpp.com endl;int a;cout 请输入数字 endl;cin a;cout 获取a的输入值 a endl;return 0; }同样的cin也可以连续接收多个变量 #include iostream using namespace std; int main(){ //cout Hello endl www.dotcpp.com endl;int a;int b;int c;cout 请输入数字 endl;cin a;cout 获取a的输入值 a endl;cout 请输入b、c数字 endl;cin b c;cout 获取b的输入值 b endl;cout 获取c的输入值 c endl;return 0; }1.3 注释 //这里我的第一个C程序单行注释 /* 多行注释 */1.4 函数 1.4.1 使用有返回的函数 sqrt是开平方返回的数据类型是double类型。 #include iostream using namespace std; int main(){ //sqrt是开平方返回的数据类型是doubledouble xsqrt(36);cout x;return 0; }1.4.2 自定义函数 自定义函数的调用必须声明函数原型。 自定义函数的使用 #include iostream using namespace std; //声明test函数原型 void test1(); void test2(int x); int test3(int x); int test4(int x,int y); int main(){ test1();test2(43);cout endl;cout 调用test2函数返回值是 test3(3) endl;cout 调用test2函数返回值是 test4(3,6);return 0; }//自定义无参数无返回值 void test1() {cout 无参数无返回值的函数test1 endl; }//自定义有参数的函数没有返回值 void test2(int x) {cout x的值是 x; }//自定义有参数的函数有返回值 int test3(int x) {return x * 30; }//自定义有多个参数的函数有返回值 int test4(int x,int y) {return x * y; }
http://www.w-s-a.com/news/374882/

相关文章:

  • 淘宝领卷网站什么做制造网站开发
  • 如何做com的网站网站建设投标书模板
  • 郑州网络营销网站优化网站技术方案怎么写
  • 济南市住房和城乡建设局网站wordpress mnews主题
  • ios开发网站app网站建设企业有哪些方面
  • 网站主页 优帮云深圳代做网站后台
  • app 与网站网站建设要做什么
  • 厦门国外网站建设公司郑州核酸点推vip服务
  • 免费网线seo外链怎么做
  • 宽带技术网网站wordpress widget hook
  • 山西省住房和城乡建设厅网站报名wordpress添加标签插件
  • 网站怎么自己做外贸网站案例
  • 做网站的优势公司网站怎么做站外链接
  • 海城网站制作建设精准营销的营销方式
  • 北京短视频拍摄公司重庆网站seo推广公司
  • 广州免费推广网站建设4399网页游戏大全
  • 网站的构架与组成建站公司兴田德润
  • php网站部署步骤邯郸哪有做网站的
  • 做设计什么设计比较好的网站南充市住房和城乡建设局考试网站
  • 郑州做系统集成的公司网站龙岩
  • 厦门SEO_厦门网站建设网络营销课程视频
  • vs 2015 网站开发开网店在线咨询
  • 前端如何优化网站性能大学学校类网站设计
  • 中国铁路建设投资公司网站熊学军中国it外包公司排名前50
  • 房产网站的建设广州推广排名
  • 湟源县网站建设wordpress删除未分类
  • 营销型网站开发推广厦门百度seo公司
  • 遵义网站开发培训上海中高风险地区名单最新
  • 禹州市门户网站建设做网站可以申请个体户么
  • 大良营销网站建设效果彩票网站搭建 做网站