摘要:
任务四、 vector.hpp #pragma once #include <iostream> using namespace std; template<typename T> class Vector { public: Vector(int n) :size{ n } { p = new T 阅读全文
摘要:
1. #include <stdio.h> #define N 5 int binarySearch(int *x, int n, int item); // 函数声明 int main() { int a[N] = {2, 7, 19, 45, 66}; int i, index, key; pr 阅读全文
摘要:
1.(1)交换1次 (2)交换3次 第一种是直接找到最大值,与最后一项交换。第二种是把相邻两项较大值放在右边,并多次比较,从而实现最大值出现在最后。 2. #include <stdio.h> #define N 5 int binarySearch(int x[], int n, int item 阅读全文
摘要:
#include<stdio.h> const int N=4; int main() { int a[N]={2,0,2,1}; char b[N]={'2','0','1','1'}; int i; printf("sizeof(int)=%d\n",sizeof(int)); printf(" 阅读全文