
功能函数
hitercch
这个作者很懒,什么都没留下…
展开
-
C++实现matlab的sort函数,返回排序后的数组和元素对应原数组的下标[B,I] = sort(arr);
直接上代码#include <iostream>#include<algorithm>using namespace std;struct node{ int value; int index;};bool cmp(struct node a, struct node b){ if(a.value<b.value){ return true; } return false;}int main()原创 2021-01-22 10:29:50 · 843 阅读 · 0 评论 -
C++实现数组元素和给定值相等的下标数组并返回vector
直接上代码#include <iostream>#include <vector>#define CNT 32using namespace std;vector<int> zhenjishu_equal_zhen_list(int zhenjishu[], int zhen, int cnt){ vector<int> ivec={}; for (int i = 0; i < cnt; ++i) {原创 2021-01-21 11:58:39 · 355 阅读 · 0 评论 -
C 语言实现matlab dec2bin功能,可实现数字转化成任意进制下的字符串,支持固定长度0填充补齐
C 语言实现matlab dec2bin功能,可实现数字转化成任意进制下的字符串,支持固定长度0填充补齐#include <stdio.h>#include<string.h>void ltoa(long num, char* str, int radix,int len){ int i = 0; int j = 0; long sum; unsigned long num1 = num; //如果是负数求补码,必须将他的绝对值放..原创 2021-01-20 12:00:57 · 924 阅读 · 0 评论