// itertest.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "pch.h"
#include <iostream>
#include <vector>
#include <assert.h>
using namespace std;
//冒泡算法;
void map_pao_suan_fa(std::vector<int>& data)
{
for (size_t i = 0; i < data.size(); i++)
{
for (size_t j = 0; j < data.size() - 1; ++j)
{
if (data[j] > data[j+ 1])
{
int temp = data[j];
data[j] = data[j + 1];
data[j + 1] = temp;
}
}
}
}
//插入排序;
void insert_sort(std::vector<int>& data)
{
for (size_t i = 1; i < data.size(); ++i)
{
int preIndex = i - 1;
int current = data[i];
for (size_t j = i; j >= 1 ; j--)
{
if (data[j] < data[j-1])
{
int temp = data[j];
data[j] = data[j - 1];
data[j - 1] = temp;
}
}
}
}
int main()
{
std::vector<int> data = {11,11,12,52,13,48,92 , 111,232,43,74,58,69,07 };
std::vector<int> l_vec = data;
//调用;
insert_sort(l_vec);
std::cout << "插入: ";
for(auto i : l_vec)
{
std::cout << i << " ";
}
std::vector<int> l_vec1 = data;
//调用;
map_pao_suan_fa(l_vec1);
std::cout<<std::endl << "冒泡: ";
for (auto i : l_vec1)
{
std::cout << i << " ";
}
char str1[10] = "abc";
char str2[] = "edf";
char* str3 = strcatEx(str1, str2);
std::cout << endl <<"strcat result: "<< str3;
return 0;
}