文件名称:vectoralist
介绍说明--下载内容均来自于网络,请自行研究使用
练习vector和list的使用
定义一个空的vector,元素类型int,生成10个随机数插入到vector中,用迭代器遍历vector并输出其中的元素值。在vector头部插入一个随机数,用迭代器遍历vector并输出其中的元素值。用泛型算法find查找某个随机数,如果找到便输出,否则将此数插入vector尾部。用泛型算法sort将vector排序,用迭代器遍历vector并输出其中的元素值。将vector清空。
定义一个list,并重复上述实验,并注意观察结果。
-Exercises vector and list defines the use of an empty vector, element type int, generate 10 random numbers inserted into the vector, iterate over the vector and the output element values. Vector iterator to traverse, and output the value of one of the elements in the vector head insert a random number. Find generic algorithms to find a random number, and if found will output, otherwise this number inserted into the vector tail. Using generic algorithms sort the vector Sort iterator traversal vector and output the value of one of the elements. The vector emptied. Define a list, and repeat the experiment, and observe the results.
定义一个空的vector,元素类型int,生成10个随机数插入到vector中,用迭代器遍历vector并输出其中的元素值。在vector头部插入一个随机数,用迭代器遍历vector并输出其中的元素值。用泛型算法find查找某个随机数,如果找到便输出,否则将此数插入vector尾部。用泛型算法sort将vector排序,用迭代器遍历vector并输出其中的元素值。将vector清空。
定义一个list,并重复上述实验,并注意观察结果。
-Exercises vector and list defines the use of an empty vector, element type int, generate 10 random numbers inserted into the vector, iterate over the vector and the output element values. Vector iterator to traverse, and output the value of one of the elements in the vector head insert a random number. Find generic algorithms to find a random number, and if found will output, otherwise this number inserted into the vector tail. Using generic algorithms sort the vector Sort iterator traversal vector and output the value of one of the elements. The vector emptied. Define a list, and repeat the experiment, and observe the results.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
vector&list.cpp