ICode9

精准搜索请尝试: 精确搜索
  • 0016 c/c++语言 二进制转换为十进制2021-04-19 23:01:13

    题目描述 输入一个二进制数(仅由0和1构成的整数),打印出该数对应的十进制数。 输入 第一行是测试数据的组数n,下面的n行每一行是一个二进制数。 输出 输出为n行,分别为对应输入的十进制数。 样例输入 2 11 110 样例输出 3 6 c++: #include <iostream> #include <string> using na

  • C++实现五种排序方式2021-03-28 09:31:01

    插入排序 #include <iostream> using std::cout; using std::endl; void printArr(int arr[], int n) { for (int i = 0; i < n; i++) { cout << arr[i] << "\t"; } cout << endl; } void insert_sort(int arr[], int n) {

  • c语言之使用指针将数组进行反转2019-12-30 16:02:16

    #include<stdio.h> #include<iostream> void reverse(int* a, int length) { int* p, temp, * i, * j, m; m = (length - 1) / 2;//取得中间的下标 i = a;//i指向数组的首元素 j = a + length - 1;//j指向数组的尾元素 p = a + m;//p指向数组中间的元素

  • 冒泡排序2019-12-17 21:04:12

    冒泡排序 冒泡排序本质上是从数组第一个元素开始,依次比较相邻的元素,根据排序要求进行大小交换,直到将最大(最小)的数放到数组尾部,而后循环排序0~n-1位上的数,直到排序结束 代码 #include <stdio.h> void BubbleSort(int arr[], int size) { if (arr == NULL || size < 2) {

  • 选择排序2019-09-26 12:52:12

    /**} * 选择排序 (将小的放在前面,每轮只和第一个数交换) * @author Administrator * */public class TestArray2 { public static void main(String[] args) { int [] arr = {6,9,3,1,4,8,5,7,2}; for (int i = 0; i < arr.length - 1; i++) {

  • <排序算法> 插入排序InsertSort2019-07-20 18:51:23

    代码实现: 1 #include<iostream> 2 using namespace std; 3 4 void PrintArr(int arr[],int len); 5 void InsertSort(int arr[],int len) 6 { 7 if(arr == NULL || len <= 0) return ; 8 9 int yes = 0; //有序下标10 int no = 1; //无序下标11 int

  • Java中的泛型理解2019-04-23 20:43:47

    泛型,又名"参数化类型",顾名思义,就是将类型由原来的具体的类型参数化,类似于方法中的变量参数,此时类型也定义成参数形式(可以称之为类型形参),然后在使用/调用时传入具体的类型(类型实参)。 泛型的本质是为了参数化类型(在不创建新的类型的情况下,通过泛型指定的不同类型来控制形参具体限制的

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有