文章 2016-06-03 来自:开发者社区

C++范型程序补充阅读

(1)下面程序通过输入流迭代器来填充vector容器,通过输出流迭代器来写入“流cout”。程序执行时,如果输入为:1 2 3 4 5 q 则输出为:1,2,3,4,5, 1 | 2 | 3 | 4 | 5 | 请填空将程序补充完整。 #include<iostream> #include<vector> #include<algorithm> u...

文章 2016-06-02 来自:开发者社区

2015级C++第15周程序阅读 范型程序设计

阅读下面的程序,对照运行结果,领会STL的用法 (1) #include <string> #include <set> #include <iterator> #include <iostream> using namespace std; int main() { set <string> strset; s...

文章 2016-05-26 来自:开发者社区

2015级C++第14周程序阅读 STL中的简单容器和迭代器

阅读并运行程序,解释程序执行得到的结果 (1) #include<iostream> #include<vector> #include<iterator> using namespace std; int main() { vector<int> ivec; int i; for(i = 0; i < 5; ...

文章 2016-04-27 来自:开发者社区

2015级C++第10、11周程序阅读(补充) 继承和派生

(1) #include<iostream> using namespace std; class G { public: static int m; G( ){ //构造函数 m++; cout<<"G begins\n"; } ~G( ) { cout<<"G ends\...

文章 2016-04-27 来自:开发者社区

2015级C++第10、11周程序阅读 继承和派生

阅读程序,请写出这些程序的运行结果 (1)阅读程序,写出执行结果 #include <iostream> using namespace std; class Data { public: Data(int i):x(i){cout<<"A";} ~Data(){ cout<<"B";} private: int x; }; c...

文章 2016-04-21 来自:开发者社区

2015级C++第9周程序阅读 类和指针

阅读程序,写出程序的运行结果并理解其运行机制。 (1) #include <iostream> using namespace std; class A { public: A(){cout<<"A";} ~A(){cout<<"~A";} }; class B { A *p; public: B() { ...

文章 2015-06-16 来自:开发者社区

《C++语言基础》程序阅读——异常处理和命名空间

返回:贺老师课程教学链接 阅读下面的程序,写出输出结果 (1) #include <iostream > using namespace std; int a[10]= {1,2, 3, 4, 5, 6, 7, 8, 9, 10}; int fun( int i); int main() { int i ,s=0; for( i=0; i<=10; i...

文章 2015-06-09 来自:开发者社区

《C++语言基础》程序阅读——二进制文件及文件的随机读写

返回:贺老师课程教学链接 1、阅读并运行下面的两个程序,分别用记事本和二进制文件阅读器(请自行下载Binary Viewer等程序,或者用DOS中的Debug程序,并百度其用法)。查看其内容,并理解文件存储的原理。 (1) #include <iostream> #include <fstream> #include <cstdlib> using ...

文章 2015-06-02 来自:开发者社区

《C++语言基础》程序阅读——标准输入输出对象及文本文件

返回:贺老师课程教学链接 1、阅读并运行下面的示例程序,掌握标准输入输出流的控制 例1#include <iostream> #include <math.h> using namespace std; int main() { float a,b,c,disc; cout<<"please input a,b,c:"; cin>...

文章 2015-05-26 来自:开发者社区

《C++语言基础》程序阅读——多态性与抽象类

返回:贺老师课程教学链接 1、阅读下面的程序,并写出运行结果(1)虚函数#include<iostream> using namespace std; class A { int a; public: A():a(5){} virtual void print()const { cout<<a;} }; class B: public A { char...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

开发与运维

集结各类场景实战经验,助你开发运维畅行无忧

+关注