JAVA中用二分法实现数组中的数据调换 public class ArrayDemo1 { public static void main(String[] args) { int[] arr = {1,2,3,4,5}; printarr(arr); sort(arr); printarr(arr); } public stat
关于JAVA中一些简单加密算法的思考 import java.util.Scanner;public class JiaMiDemo { public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println(“请输入您要加密的数据:”); int pas
【windows】创建hellowin的窗口 #include"windows.h"#include"stdio.h"int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow){ static CHAR szAppName []=TEXT("HelloWin"); HWND hwnd; MSG msg; W
2016年,写给自己看 2015年9月16日,伴随着火车的轰鸣声带上战友们的祝福,我退伍返到家乡,家中的一切依然是那么温馨熟悉与美好,但是我知道,我已经不是当年那个小混混了,回想起过去两年,就跟做了一场长梦一样,在这场长梦中我学会了独立,学会了观颜察色与接人待物,也学会了如何为人处事;在绿色的军营之中我体会到了一名军人内务的标准,体会到了一名军人如何做到令必行,禁必止,同时也感谢我的指导员像伯乐一样器重我,把我放在“文书
【C++】用指针数组构造字符串数组 #include"iostream"using namespace std;//用指针数组构造字符串数组 void List(char a[]){char *p = a;while(*p!='\0'){if(*p==' ')coutcoutp++;}}int main(){char a[]={"China boy zhang xu"};char *p ;p
【C++】用指针数组构造字符串数组 #include"iostream"using namespace std;//用指针数组构造字符串数组 int main(){char*Week[]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};int i;coutcin>>i;cout }
【C++】逆序存放数组元素值 #include"iostream"using namespace std;//逆序存放数组元素值 void invert(int a[],int n){int i,j,temp;for(i=0,j=n-1;i{temp = a[i];a[i] = a[j];a[j] = temp;}}int main(){int i,a[10]={1,2,3,4,5,6,7,8
【C++】指向结构体变量的指针 #include"iostream"#define N 10using namespace std;//指向结构体变量的指针struct Student{int numb;char *name;char sex;float score;};Student stu1 = {001,"zhangxu",'G',100};int main(){Student *p;p
【C++】实现整数排序 #include"iostream"#define N 10using namespace std;//实现整数排序void swap(int a[],int n){int i,j,temp;for(i=0,j=i+1;jif(a[i]>a[j]){temp = a[i];a[i] = a[j];a[j] = temp;}}int main(){int a[
【C++】使用指针实现数据交换 使用指针变量实现交换两个变量(a,b)的值#include"iostream"using namespace std;//使用指针变量实现交换两个变量(a,b)的值 void swap(int* a,int* b){int temp;temp = *a;*a = *b;*b = temp;}int main(){int a,b;coutcin>>a>>b;
【C++】使用函数指针制作菜单管理… #include"iostream"using namespace std;struct MENU{char* Name;void (*func)(); //func为指向函数的指针变量,该函数没有参数,不返回值 };//菜单功能函数void FileFunc(); //文件菜单 void EditFunc(); //编辑菜单 void ViewFunc()
【C++】指针作为函数的返回值 #include"iostream"using namespace std;int *GetDateFromIndex(int index);int main(){int i;for(i=0;i{cout}}int *GetDateFromIndex(int index){int Date[]={99,98,97,96,95,94,93};return &Date[in
【C++】指针作为函数的参数 #include"iostream.h"#include"stdio.h"void showmessage(char *p){cout}void main(){//定义字符串数组char *cp = "大家好,这里是指针作为函数参数的实例。";showmessage(cp);//定义字符串数组char str[]="大家好,这里是指针作为函数参数的实例。";showme
【C++】结构指针遍历结构数组 #include"iostream.h"#include"stdio.h"struct people{char name[10];int age;};people pe[] = {{"zhangsan",13},{"lisi",14},{"wangwu",15}};void main(){people *p = pe;int i;for(i=0;i{cou
【C++】指针和数组的常用方法 #include"iostream.h"#include"stdio.h"void main(){char str[]="大家好,见到诸位很高兴。";char *p;int i;//指针访问,指针表示for(p=str;*p;p++)coutcout//下标访问,下标表示for(i=0;str[i];i++)coutcout//下标访问,指针表示for(i=0;*
【C++】利用指针表达式遍历数组 #include"iostream.h"#include"stdio.h"void main(){int array[]={91,95,97,93,96,25,64};int i,*p = array;for(i=0;i{cout";p++;}}
【C++】将结构作为参数传递并返回 #include"iostream.h"#include"stdio.h"#include"string.h"struct Date{int day,month,year;};Date GetDate();void PrintDate(Date dd);void main(){Date dt = GetDate();PrintDate(dt);}Date Ge
【C++】如何使用嵌套结构 #include"iostream.h"#include"stdio.h"#include"string.h"struct Date{int day,month,year;};struct Student{int numb;char name[16];Date birthDate;};void main(){Student stu1 = {001,"zhang
【C++】结构体变量的初始化 #include"iostream.h"#include"stdio.h"#include"string.h"//学生基本信息的初始化struct Student{int numb;char name[16];bool sex;char address[16];}stu1;void main(){stu1.numb=001;strcpy(stu1.name,"zha