![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数组
看星星凋零
这个作者很懒,什么都没留下…
展开
-
将一个长度不定数组按照自定义标准进行排序
#include "stdafx.h"#include"vector"#include<iostream>using namespace std;void GetRealIndex(vector<int>source, int dest[]){ //source = {1,2,5,6,8,10,12,14}; int temp[17] = { 0, 1, 9, 2, 10...原创 2018-02-27 16:16:38 · 545 阅读 · 0 评论 -
将十六个通道(1-8,9-16)按上一个加下一个顺序输出
// setnum.cpp : 定义控制台应用程序的入口点。#include "stdafx.h"#include"vector"#include<iostream>using namespace std;void setnum(int source[],int count){ int m = 0,n=0; vector<int> temp1, temp2; for (si...原创 2018-03-01 11:31:02 · 182 阅读 · 0 评论 -
读入一组整数并将它们存入一个vector对象,将每个相邻整数的和输出出来。
/*读入一组整数并将它们存入一个vector对象,将每个相邻整数的和输出出来。*/#include"stdafx.h"#include"iostream"#include"vector"using namespace std;int main(){ vector<int> vint; int ival; cout << "请输入一组数字,以其他非数字字...原创 2018-03-05 13:17:34 · 2085 阅读 · 0 评论 -
数组初始化问题
对于string类型的数组来说,因为string类本身接受无参数的初始化方式,所以不论数组定义在函数内还是函数外都被默认初始化为空串。对于内置类型int来讲,数组定义在所有函数体之外,根据c++规定,数组默认初始化为0,;对于定义在main函数中的数组,将不会被初始化,如果试图或者输出未初始化的变量,将会遇到未定义的奇异值。...原创 2018-03-05 14:02:24 · 392 阅读 · 0 评论 -
多维数组输出的几种方式(不包括普通for语句和下标运算符)
/*使用范围for语句和普通for语句与指针方法输出使用c++11新提供的类型别名申明代替循环控制变量的类型,使得外层循环变量的含义更直观使用c++11新提供的auto关键字自动推断循环控制变量的类型,降低程序难度*/#include"stdafx.h"#include"iostream"using namespace std;using int_array = int[4];int ma...原创 2018-03-05 15:39:07 · 671 阅读 · 0 评论