# 1.用选择法对十个整数排序

#include<iostream>
using namespace std ;
int numbers[10];
void ascending();
void Cins();
void couts();
void main()
{
Cins();
ascending();
couts();
system("pause");
}
void ascending()
{
int x=0;
int y = 0;
int z ;
for(int i=0+x;i<=9;i++)
{
for (int v=1+y;v<=9;v++)
{
if (numbers[i]>=numbers[v])
{
z = numbers[i];
numbers[i] = numbers[v];
numbers[v] = z;
}
}
x++;
y++;
}
}
void Cins()
{
for (int i=0;i<=9;i++)
{
cout << "输入第" << i + 1 << "个数字;" << endl;
cin >> numbers[i];
}
}
void couts()
{
for (int i=0;i<=9;i++)
{
cout<< numbers[i] <<endl;
}
}

# 2.求一个3*3对角线的元素之和

#include <iostream>
using namespace std;
void countNumbers(int x);
void cins();
int  a[3][3];
int b[3];
void main()
{
cins();
countNumbers(3);
system("pause");
}
void countNumbers(int x)//决定数组长度，仅限于有长度的数组;
{

for(int i=0;i<x;i++)
{
b[i] = a[i][i] + a[i][x - 1 - i];
}
for(int s=1;s<=x-1;s++)
{
b[s] = b[s-1] + b[s];
}
cout << b[x-1] << endl;
}
void cins()
{
for (int d=0;d<3;d++)
{
for (int w=0;w<3;w++)
{
cout << "请输入"<<d <<w<< "字符;"<< endl;
cin >> a[d][w];
}
}
}

# 3.有一个已经排序好的数组，现在输入一个数，按照原来的规律插入数组

#include<iostream>
using namespace std;
int numbers[11];
void ascending(int NumbersLongs);
void Cins();
void couts();
void CinTwo();
int NumbersLong=9;
void main()
{
Cins();
ascending(9);
couts();
CinTwo();
system("pause");
}
void ascending(int NumbersLongs)
{
NumbersLong = NumbersLongs;
int x = 0;
int y = 0;
int z;
for (int i = 0 + x; i <= NumbersLongs; i++)
{
for (int v = 1 + y; v <= NumbersLongs; v++)
{
if (numbers[i] >= numbers[v])
{
z = numbers[i];
numbers[i] = numbers[v];
numbers[v] = z;
}
}
x++;
y++;
}
}
void Cins()
{
for (int i = 0; i <= NumbersLong; i++)
{
cout << "输入第" << i + 1 << "个数字;" << endl;
cin >> numbers[i];
}
}
void couts()
{
for (int i = 0; i <= NumbersLong; i++)
{
cout << numbers[i] << endl;
}
}
void CinTwo()//新输入数字排序输出；
{
cout << "输入一个新数字;" << endl;
cin >> numbers[10];//添加入已经排序好的数组;
++NumbersLong;
cout << "新的排序" << endl;
ascending(10);
couts();

}


# 4.将一个数组值按照逆顺序重新存放

#include <iostream>
using namespace std;
int a[6] ;
void Cins();
void count(int p);
void Coutss();
void main()
{
Cins();
count(6);
Coutss();
system("pause");
}
void count(int p)
{
int x=0;
for (int i=0;i<=2/p;i++)//
{
x = a[i];
a[i] = a[p - i - 1];
a[p - i - 1] = x;
}
}
void Cins()
{
for (int i=0;i<=5;i++)
{
cin >>a[i];
}
}
void Coutss()
{
for (int e = 0; e <= 5; e++)
{
cout << a[e] << endl;
}
}

## 3 对 “c++基础第五章课后练习第二部分”的想法；

1. This is Robert Kowalski from LegalPL Company from Poland-Warsaw (Europe).
In this mail sending you special our offer about immigration services to Europe:
1. Work 1 Year Visa to Poland (Work Visa+Work Permit);
2. Study in Poland (Study 1 Year Visa);
Mostly our clients from India, Pakistan, Nepal, Bangladesh, Vietnam, China, Iran, Ukraine, Russia, Belarus, Philippines, Indonesia, Vietnam, China.
If you are interesting in our services, please contact with us in WhatsUp/Viber/Telegram +48 793 636 986 or write me: r.kowalski@legalpl.net
Thank you,
Best Regards,
Robert Kowalski,
LegalPL Company

2. This is Robert Kowalski from LegalPL Company from Poland-Warsaw (Europe).
In this mail sending you special our offer about immigration services to Europe:
1. Work 1 Year Visa to Poland (Work Visa+Work Permit);
2. Study in Poland (Study 1 Year Visa);