摘要:#include#include#define N 20#define M 81int getstr(char p[][M]){ char t[M],n=0; /*printf("enter string a empty string to end\n"); ...
阅读全文
摘要:#includeint main(){ int a,b,x; puts("输入头数量:");scanf("%d",&a); puts("输入脚数量:");scanf("%d",&b); x=-(b-a*4)/2; printf("鸡:%d 兔子:%d",x,...
阅读全文
摘要:#includeint a,b;float c,d;int main(){ int f2(); int f1(); a=1; b=2; c=50.0; d=60.0; printf("i am in main1 a=%d b=%d c=%f d=%f\n",...
阅读全文
摘要:#includeint a,b;int f1(){ int a=10; printf("i am in f1 a=%d b=%d\n",a,b);}float c,d;int f2(){ float c=100.0; printf("i am in f2 a=...
阅读全文
摘要:file1 #includeextern float function(float a);int main(){ printf("reseult=%f\n",function(3.0));} file 2 float function(float a){ re...
阅读全文
摘要:int huiwen(char *s){ char *p = s; while(*p) p++; p--; while(s<p) { if(*s != *p) return 0; s++; p--; ...
阅读全文
摘要:#includeint main(){int y,m,ds,flag,n,d,k;scanf("%d %d %d",&y,&m,&ds);if(y%400==0)flag=1;else{if(y%4==0&&y%100!=0)flag=1;else flag=...
阅读全文
摘要:#includeint main(){ int a,b,x; a=35; b=84; x=-(84-35*4)/2; printf("%d %d",x,35-x);}
阅读全文
摘要:#include #define N 10void main(void){ int a[N] = {-2, -1, 0, 1, 3, 4, 7, 9, 13, 17}; int i,low=0,high=N-1,mid,ret=-1; int key; //...
阅读全文
摘要:#include #define N 10void main(void){ int a[N] = {-2, -1, 0, 1, 3, 4, 7, 9, 13, 17}; int i,low=0,high=N-1,mid,ret=-1; int key; //...
阅读全文
摘要:#includeint main(){ int a[7][7]={0},i,j,b[7][7]={0}; int x,y,t; for(i=1;i=a[x][y]) t++; } } if(t==9) b[i][j]++; } ...
阅读全文
摘要:#includeint main(){ int temp[6][4]; int i,j,sum=0; for(i=0;i<5;i++) { for(j=0;j<3;j++) { scanf(...
阅读全文
摘要:#include #define N 10void main(void){ int a[N] = {-2, -1, 0, 1, 3, 4, 7, 9, 13, 17}; int i,low=0,high=N-1,mid,ret=-1; int key; //...
阅读全文
摘要:#include int sum(int a,int b, int c){ int sum1; sum1=a+b+c; return sum1;}int main(void) { int a, b, c; scan...
阅读全文
摘要:#include int max(int a,int b,int c) { int max1=b; if(a>b&&a>c) max1=a; else if (c>a&&c>b) max1=c; return max1; } int main(...
阅读全文
摘要:#include void main(){ int a,b,c,n; scanf("%d",&n); a=n/100; b=n/10%10; c=n%10; printf("%d%d%d",c,b,a);}
阅读全文
摘要:#include "stdio.h"int main(void){ float value,sum=0.0; unsigned n=0; scanf("%f",&value); do { sum+=(float)1.0/++...
阅读全文
摘要:#include void main(){int a,ret=0,t;scanf("%d",&a);while(a>0){ t=a%10; ret=t;printf("%d",ret); a=a/10; }}
阅读全文
摘要:#includeint main() { int x,y;scanf("%d",&x);y=x/10;switch(y){ case 0:case 1:printf("80");break;case 2:case 3:printf("160");brea...
阅读全文
摘要:#include #include void main(){ int a,i,c,b,t; scanf("%d",&a); t=a;i=0; while(t>0){t=t/10;i++;} //计算a的位数i for(b=i-1; b>=0...
阅读全文
摘要:#includeint get_days_of_month(int year, int month){//补足函数 int days,flag; //printf("Please input year:"); // ...
阅读全文
摘要:#include #include int is_prime(int n){ int a,b=1,k; k=sqrt (n); for(a=2;a<=k;a++) { if(n%a==0) { b=0; break ; } } if(n==...
阅读全文
摘要:#include#include#define N 20#define M 81int getstr(char p[][M]){ char t[M],n=0; printf("enter string a empty string to end\n...
阅读全文
摘要:#includeint main(){ int x,y; scanf("%d",&x); if (x<1) y=x; else if (x<10) y=2*x-1; else y=3*x-11; printf("%d\n",y); return 0;} ...
阅读全文
摘要:#includeint main(){ int a; scanf("%d",&a); printf("%d\n",a>100||a<0); return 0;}
阅读全文
摘要:#includeint main(){int a;scanf("%d",&a);if (a%2==0){printf("even");}else{printf("odd");}return 0;}
阅读全文
摘要:#includeint main(){ float f,c; scanf("%f",&f); c = (f - 32)*5/9; printf("%.2f",c); return 0;}
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include #include #include int my_strcmp(char a[], char b[]){ int i,x; char *p1=a,*p2=b; wh...
阅读全文
摘要:#includeint main(){char a[20],*p=a;long x;scanf("%s",a);while(*p!='\0'){ x=(*p-48);p++;printf("%ld",x);}}
阅读全文
摘要:#include#include#define n 5void sort(char *p[n],int k){ int i, j; char* temp;//定以以个空指针方便交换0 for (i = 0;i 0)//注意函数里面的参数的是字符串的地址 ...
阅读全文
摘要:#include int main(void){ int i,j; int n; int a[32]; scanf("%d",&n); for(i=0;n>0;i++) { a[i]=n%2; n/=2; } for(j=i-1;j>=0;j...
阅读全文
摘要:#include int sum(int a,int b, int c){ int sum1; sum1=a+b+c; return sum1;}int main(void) { int a, b, c; scan...
阅读全文
摘要:#include #include void my_strcpy(char dst[], char src[]){ int i=0; for(; dst[i]!='\0';i++) dst[i]=src[i]; dst[i]='\0';}void mai...
阅读全文
摘要:#includeint main(){ int n; scanf("%d",&n); printf("%d",digui(n));}int digui(int n){ int sum=0,i; for(i=0;i<n+1;i++) { sum+=i; } r...
阅读全文
摘要:斐波那契数列:0、1、1、2、3、5、8、13、21、34 #include int Fib(int n);int main() { int n; scanf("%d",&n); printf("%d\n",Fib(n)); return ...
阅读全文
摘要:#includeint main(){ int i=0,k,sum=1; char a[128]; gets(a);for(;a[i]!='\0';i++){ if(a[i]==' ') sum++; } printf("%d",sum);} ...
阅读全文
摘要:#includeint main(){ int a[20],i,sum,j,k,b[10]={0,1,2,3,4,5,6,7,8,9}; for(i=0;i<20;i++) scanf("%d",&a[i]); for(k=0;k<10;k++) { s...
阅读全文
摘要:#includeint main()#define n 80{ int i,j,t,m,a[n],*p,flag; scanf("%d",&m); p=a; for(i=0;ia[j+1]) { t=a[j]; a[j]=a[j+1]; ...
阅读全文
摘要:回文1 #includevoid main(void){ int list[32], len=0, i; int a, t; scanf("%d", &a); while (a) { t = a % 10; lis...
阅读全文
摘要:冒泡排序法1 例子:2 15 32 54 65 #define n 32#includeint main(void){ int i,j,t; int a[n]; for(i=0;ia[j+1]) { t=a[j]; a[j]=a[j...
阅读全文
摘要:输出字符串中的大写字母 #includeint main(){ char a[100]; char *p; p=gets(a); while(*p) { if(*p>='A'&&*p...
阅读全文
摘要:输入十个数,求最大,最小值,平均数,和。 #includeint main(){ int a[10],i,sum=0,max,min; float average; for(i=0;ia[i]) min=a[i]...
阅读全文
摘要:Hanoi塔问题 #includeint move(int n,int x,int y,int z){ if(n==1) printf("%c-->%c\n",x,z); else { move(n-1,x,z,y); printf("%c-->%c\n...
阅读全文
摘要:使用递归,判断回文 #include #includeint main(){ int begin ,end; char s[100]; gets(s); begin=0;end=strlen(s)-1; printf("%d",huiwe...
阅读全文
摘要:将十进制转换二进制,使用递归 #includeint main(){ int b; scanf("%d",&b); er(b);}int er(int n){ if(n>1) er(n/2); printf("%d",n%2);} ...
阅读全文
摘要:冒泡法与递归解决绝对值排序-99, 98, 102, -101, 100 #include #include void swap(int* a, int* b) { int tmp; tmp = *a; *a=*b; *b=tmp;}void printf_l...
阅读全文
摘要:利用递归求最大公因子 #includeint gys(int a,int b){ int c; if(a<b) { c=a;a=b;b=c; } if(b!=0) return gys(b,a%b); ...
阅读全文
摘要:package com;public class app3_8 { public static void main(String[] args) { int a=25,b=7; boolean x=a5; //y...
阅读全文
摘要:第一种 输入 20 输出 sum=5 #include int main(){ int a,sum=0;int i = 11; scanf("%d",&a); for (;i int main(){ int a,sum=0 i ...
阅读全文
摘要:Java当中"abc"+"de"="abcde" ,类似c语言中的strcat函数。 输入 abc de 输出效果 package com;import java.io.*;public class strcat { public static...
阅读全文
摘要:题目描述 输入一行字符,分别统计出其中英文字母、数字、空格和其他字符的个数。 输入 一行字符,长度不超过200 输出 统计值 样例输入 aklsjflj123 sadf918u324 asdf91u32oasdf/.';123 样例输出 23 16 2 4 ...
阅读全文
摘要:新四级冲刺需牢记的700核心词 1. alter v. 改变,改动,变更2. burst vi./ n. 突然发生,爆裂3. dispose vi. 除掉;处置;解决;处理 (of) 4. blast n. 爆炸;气流 vi. 炸,炸掉5. c...
阅读全文
摘要:例子: 输入 1 11 2 3 输出 4 贪心算法 #include#includeint n,m,a,b,i;int z[200005];int f[200005];long ans=0;//m==0void solve1(){ ...
阅读全文
摘要:例子 52 6 4 10 20 结果:10 50 0 0 0 0 结果:5 思路:(Max - Min) / Subtract (最小差值)+ 1(比如(20 - 2) / 2 + 1 = 10) #include#include#in...
阅读全文
摘要:例子: 输入: 7165432 输出: 2 分析:输入7个数 二叉树为: 1 6 5 4 3 2 1 用数组sum来计算每个深度的权值和为多少。 每个深度的最后一个数为(2的deep次方-1),根据这...
阅读全文
摘要:第二种类型的输入数据方式。 import java.io.*;public class fuck{ public static void main(String[] args)throws IOException { Strin...
阅读全文
摘要:import java.io.*;public class fuck{ public static void main(String[] args)throws IOException { char st1; Buffe...
阅读全文
摘要:package com;import java.util.*;public class app3_6 { public static void main(String[] args) { int num1; dou...
阅读全文
摘要:package com;import java.io.*;public class app3_5 { public static void main(String[] args)throws IOException { int nu...
阅读全文
摘要:package com;import java.io.*;public class app3_4 { public static void main(String [] args) throws IOException { floa...
阅读全文
摘要:import java.io.*;public class app3_3{ public static void main(String[] args) throws IOException { BufferedReader bu...
阅读全文
摘要:class java3_2{ public static void main(String[] args) { int a=155,b=9; float g,h; System.out.println...
阅读全文
摘要:System.out.println()语句,其功能是输出括号中的表达式的值然后换行。 public class app3_1{ public static void main(String[] args) { int a=15...
阅读全文
摘要:public class Hello//定义Hello类 { public static void main(String[] args)//定义主方法 { System.out.println("Hello World!")...
阅读全文
摘要:题目描述 输入两个正整数m和n,求其最大公约数和最小公倍数。 输入 两个整数 输出 最大公约数,最小公倍数 样例输入 5 7 样例输出 1 35 本例中运用高中之前的数学知识短除法,或者叫倒除法。 用公因子进行相除。 #include int main(...
阅读全文
摘要:样例输入 5 7 样例输出 1 #include int gcd (int a,int b){ int i=1,last=1,min=1; if(a<b) min = a; else min = b; ...
阅读全文
摘要:题目描述 输入两个正整数m和n,求其最大公约数和最小公倍数。 输入 两个整数 输出 最大公约数,最小公倍数 样例输入 5 7 样例输出 1 35 #include int gcd (int a,int b){ int i=1,last=1,min=1...
阅读全文
摘要:题目描述 给出一百分制成绩,要求输出成绩等级‘A’、‘B’、‘C’、‘D’、‘E’。 90分以及90分以上为A,80-89分为B,70-79分为C,60-69分为D,60分以下为E。 输入 一个整数0-100以内 输出 一个字符,表示成绩等级 样例输入 9...
阅读全文
摘要:题目描述 企业发放的奖金根据利润提成。利润低于或等于100000元的,奖金可提10%; 利润高于100000元,低于200000元(1000001000000时,超过1000000元的部分按1%提成。从键盘输入当月利润I,求应发奖金总数。 输入 一个整数,当月...
阅读全文
摘要:给出一个不多于5位的整数,要求 1、求出它是几位数 2、分别输出每一位数字 3、按逆序输出各位数字,例如原数为321,应输出123 输入 一个不大于5位的数字 输出 三行 第一行 位数 第二行 用空格分开的每个数字,注意最后一个数字后没有空格 第三行 按逆序...
阅读全文
摘要:有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛? 输入 输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0#include int main(){ int ni...
阅读全文
摘要:要将“China“译成密码,译码规律是:用原来字母后面的第4个字母代替原来的字母.例如,字母“A“后面第4个字母是“E“.“E“代替“A“。因此,“China“应译为“Glmre“。请编一程序 输入 China 输出 加密后的China 样例输入 China...
阅读全文
摘要:#includeint look(int n){ int a,b; if(n==0)return 0; while(n) { a=n%10; if(a==2||a==0||a==1||a==9) return 1; n=n/10; } return ...
阅读全文
摘要:答案:40785 使用二个for语句循环求前面二位数,最后一位用2019-前面二位数得出; 用加法递增,升序进行循环,避免造成同一种方法重叠出现。 #includeint look(int n){ int t; while(n) { t=n%10; n...
阅读全文
摘要:#includeint a[20190325];int main(){ int i=4; a[1]=1; a[2]=1; a[3]=1; while(iint main(){ int a[20190325]; int i=4; a[1]=1; a[2]=...
阅读全文
摘要://A-Z:26//AA-ZZ:26x26=676//AAA-ZZZ:26x26x26=17576//故答案为三个字母//2019-676-26=1317 也就是三位字母的第1317个#includeint a[4]={0};int i;int main(...
阅读全文
摘要:1 97 90 0 0 02 92 85 96 0 03 0 0 0 0 934 0 0 0 80 865 89 83 97 0 06 82 86 0 0 07 0 0 0 87 908 0 97 96 0 09 0 0 89 0 010 95 99 0...
阅读全文
摘要:计算机网络第七版答案 第一章 概述 1-01 计算机网络向用户可以提供那些服务?答: 连通性和共享 1-02 简述分组交换的要点。 答:(1)报文分组,加首部(2)经路由器储存转发(3)在目的地合并 1-03 试从多个方面比较电路交换、报文交换...
阅读全文
摘要:#includeint main(){ int n,i; long fac; scanf("%d",&n); printf("%d",py(n)); return 0;}int py(int k){ int sum,i; long fac; fac=1,sum...
阅读全文
摘要:#includelong fac(int n){ long sum; if(n==1) sum=1; else sum=n+fac(n-1); return sum;}int main(){ int a; scanf("%d",&a); printf("%d...
阅读全文
摘要:例子:380 153 #include#includeint main(){ int n; printf("输入一个三位数:"); scanf("%d",&n); get_count(n); return 0;}int get_count(int n)...
阅读全文
摘要:#includeint main(){ int a,b,c; printf("输入正方形的边长:\n"); scanf("%d",&a); printf("其周长:%d\n其面积:%d",a*4,a*a);}
阅读全文
摘要:#includeint main(){ int a,b,c,num1; scanf("%d%d%d",&a,&b,&c); if(a>b&&a>c) num1=a; else if(b>a&&b>c) num1=b; else num1=c; printf...
阅读全文
摘要:#define N 2#define M N+1#define NUM 2*M+1#includeint main(){ int i; for(i=1;i<=NUM;i++)//2*2+1+1=6 printf("%d\n",i);} ...
阅读全文
摘要:#include#includeint main(){ float a,b,c,d,x1,x2; printf("输入系数abc:"); scanf("%f%f%f",&a,&b,&c); d=b*b-4*a*c; x1=(-b+sqrt(d))/(2*a);...
阅读全文
摘要:#includeint main(){ int a,b,c,i; scanf("%d",&a); if(a%2==0) printf("%d是偶数淦\n",a); else printf("%d是奇数\n",a); if(a%7==0) printf(...
阅读全文
摘要:例子:153 水仙花数是指3位数的各位数字的立方和等于这个3位数数的本身 153=1*1*1+5*5*5+3*3*3 #include#include//math.h要写,不然后续计算会出错int main(){ int x,y,a,b,c; printf("...
阅读全文
摘要:例子 例子:153 水仙花数是指3位数的各位数字的立方和等于这个3位数数的本身 153=1*1*1+5*5*5+3*3*3
阅读全文
摘要:例子: 91 92 93 56 85 #includeint main(){ int a[5]; int i=0,sum=0; for(;i90) sum++; } printf("%d",sum);}
阅读全文
摘要:#includeint main(){ int a,b=0,c; printf("输入一个不多于5位的正整数\n");//实际上它可以淦到9位 scanf("%d",&a);c=a; while(c%10!=0) { b++; c=c/10; } p...
阅读全文
摘要:#include#includeint main(){ int a=0,b,c;char d[3];//1个汉字在其中占2个字节,外加一个"\0"做为结束语; printf("输入性别\n"); scanf("%s",&d); printf("输入身高\n")...
阅读全文
摘要:#include#includeint main(){ char st1[30]="My name is"; char st2[30]; printf("input your name:\n"); gets(st2); strcat(st1,st2); put...
阅读全文
摘要:例子 :15 32 54 65 45 46 12 84 65 78 #includeint i,j;int main(){ int m;int st[32]; printf("输入排序的个数:"); scanf("%d",&m); printf("输入排序的内...
阅读全文
摘要:#includeint main(){ int i,j; int a[4][4]={{1,2,3,4},{5,6,7,8},{4,3,2,1},{1,2,3,4}};//定义一个数组a并进行初始化; for(i=0;ia[j][i]) a[j][i]=a...
阅读全文
摘要:例子:1 2 5 6 4 5 8 9 1 2 #includeint main(){ int s[10]={0}; int t,y,i,j; printf("输入要排序的10个数字:"); for(i=0;is[y]) y=i;//j+1范围中找出最大值...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#define N 100struct student{ int num; char name[20];};void swap_stu...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#include#includeint main(){ int i; int ret; int n; char str[20]; FILE *fp; char ch;...
阅读全文
摘要:#include#include#include#define nu NULLint main(){ FILE *fp; char string[81]; if((fp=fopen("file1.csv","w"))==nu) { printf("cann...
阅读全文
摘要:#include#include#include#define nu NULLint main(){ FILE *fp; char string[81]; if((fp=fopen("file1.txt","w"))==nu) { printf("canno...
阅读全文
摘要:#define n 32#includeint main(void){ int i,j,t; char a[n]; for(i=0;ia[j+1]) { t=a[j]; a[j]=a[j+1]; a[j+1]=t; }...
阅读全文
摘要:#include#include#include#define nu NULLint main(){ FILE *fp;char string[128]; char ch;char a[128],b[128]; printf("本程序用于创造一个文件,或者搜索...
阅读全文
摘要:#include#includeint main(){ FILE *infp,*outfp; char ch;char a[128],b[128]; printf("请输入本文件目录中存在的文件名加后缀:"); gets(a);//infile.txt pri...
阅读全文
摘要:#include"stdio.h"#include"stdlib.h"#define nu NULLint main(){ char a[128]; FILE *fp;int count=0; printf("本程序计算txt文本的字符个数\n"); prin...
阅读全文
摘要:可判断文件是否打开 创建文件inflie.c #include#includeint main(){ FILE *infp,*outfp; char ch; if((infp=fopen("infile.c","r"))==NULL) { printf("c...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include #include //malloc free等函数会使用到这头文件//定义链表的节点typedef struct node_s { long num; //学号 fl...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include #include //malloc free等函数会使用到这头文件//定义链表的节点typedef struct node_s { long num; //学号 ...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include #include //malloc free等函数会使用到这头文件//定义链表的节点typedef struct node_s { long num; //学号 ...
阅读全文
摘要:#includeint main(void){ int year,month,days=0,day,flag,sum=0; printf("Please input year:"); scanf("%d",&year); ...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#includeint main()//主函数要写{ int i,n;//变量i,n要先定义才能使用。 int *p; scanf("%d",&n); p=(int*...
阅读全文
摘要:#include#includeint main(){ int n,i;int *p; p=(int *)malloc(9*4); scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&p[i]); for(i=0;i<n;...
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS#include #include #include typedef struct node_s { long num; float score; struct node_s* n...
阅读全文
摘要:#includeint func(int a){ if(a=10) return 3*a-11; else return 2*a-1;}int main(void){ int x; scanf("%d", &x); printf("%d\n...
阅读全文
摘要:#include#define ADD(x) x+xint main(){ int m=1,n=2,k=3; int sum=ADD(m+n)*k; printf("%d",sum);}//10 #include#define ADD(x) x+xint ma...
阅读全文
摘要:#includeint main(void){int year,month,days=0,day,flag,sum=0;int i=1;scanf("%d",&year);scanf("%d",&month);scanf("%d",&day);if(year%...
阅读全文
摘要:#include#define FUN(x) x*2+x*2+x*2 //补充宏定义内容void main(void){ int a; scanf("%d", &a); printf("%d\n", FUN(a)); printf("...
阅读全文
摘要:#include #include typedef struct { int num; char name[20]; int score;} stu;int find(stu list[], int list_len, char *find_...
阅读全文
摘要:#include#includetypedef struct zimu{ char a[32]; char b[32]; char c[32];}str;int main(){ int i,k=0,j,t=0; str x={0}; scanf("%s",&x...
阅读全文
摘要:#include#define FUN(x) x*2+x*2+x*2int main(){ int a,b,c; scanf("%d",&a); b=a+1;c=FUN(a); printf("%d\n",FUN(a)); printf("%d\n",FUN(...
阅读全文
摘要:#include #include #include #define N 5typedef struct student{ char num[10]; char name[20]; int age;}stu;void swap_student(stu *...
阅读全文
摘要:编译器算出来的字节数比人工算出来的多,编译器考虑到字节对齐的原因,要求4字节对齐,读取效率加快。 人工是按1字节进行对齐。 人工的 #include#pragma pack (1)struct student{ char name...
阅读全文
摘要:#include #include #include #define N 5typedef struct student { char num[10]; char name[20]; int age;}stud;void swap_student(str...
阅读全文
摘要:#includetypedef struct student{ char num[10],name[20]; int age;}stud;int main(int argc,char* argv[]){ int i=0; stud stu[2]; scanf(...
阅读全文
摘要:#include#include#define M 5#define N 20void swap(char a[], char b[]) { char st[N]; strcpy(st, a); strcpy(a, b); strcpy(b,...
阅读全文
摘要:#include int main(void){ int i,j; int n; int a[32]; scanf("%d",&n); for(i=0;n>0;i++) { a[i]=n%2; n/=2; } for(j=i-1;j>=0;j--)...
阅读全文
摘要:#include int main(){ char ch = 0; int i; int a[10] = {0}; while (ch != '\n') { scanf("%c", &ch); if (ch ...
阅读全文
摘要:#includeint main(){ int i,a=1,total=0; for(i=2;i<=229;i++) { if(prime(i)) { if(total++%10==0 ) printf("\n"); printf...
阅读全文
摘要:#include "stdio.h"int main(void){ float value,sum=0.0; unsigned n=0; while(1) { if(scanf("%f",&value)==1) ...
阅读全文
摘要:#include int prime(int m);int main(){ int i, m ; scanf("%d",&m); for(i = 3; i <= m; i+=2) { if(prime(i) && prime(m-i)) ...
阅读全文
摘要:#includeint main(){ int i,n,a; scanf("%d",&a); for(i=1;i<a;i++) { if(a%i==0) printf("%d\n",i); } return 0;}
阅读全文
摘要:#includeint main(){ float score,sum=0,average,num1,sum1;int n=0;scanf("%f",&score);while(score>=0){ sum+=score; n++; scanf("%f",&s...
阅读全文
摘要:#includeint main(){ int n,sum,i; long fac; scanf("%d",&n); fac=1,sum=0; for(i=1;i<=n;i++) {fac=i*fac; sum=fac+sum; } printf("%d",...
阅读全文
摘要:#includeint get_days_of_month(int year, int month){//补足函数 int days,flag; //printf("Please input year:"); // ...
阅读全文
摘要:#include int lcm (int a,int b){ int i=1,last=1,min=1,z; if(aint main(){ int m, n;int i = 2; int j, k; int l...
阅读全文
摘要:#include #include int is_prime(int n){ int a,b,k; k=sqrt (n); for(a=1;a<=k;a++) { if(n%a==0) { b=0; break ; } } return b...
阅读全文
摘要:#includeint main(){ double r1,r2,s; double a_r1,a_r2; scanf("%lf",&r1); scanf("%lf",&r2); s=3.1415926*(r1*r1-r2*r2); printf("a...
阅读全文
摘要:#includeint main(){ double a,b,c,sum; scanf("%lf%lf%lf",&a,&b,&c); sum=a+b+c; printf("%+020.4f\n",sum/3); return 0;} ...
阅读全文
摘要:#includeint main(){ double a,b,c,sum; scanf("%lf%lf%lf",&a,&b,&c); sum=a+b+c; printf("%+020.4f\n",sum/3); return 0;} ...
阅读全文
摘要:#includeint main(){ int x,y,z,min; scanf("%d%d%d",&x,&y,&z); min=x; if (min>y) min=y; else (min=x); if(min>z) min=z; printf("...
阅读全文
摘要:#includeint main(){int a,b;scanf("%d",&a);printf("%d",a>100||a<0);}
阅读全文
摘要:#includeint main(){ char A,B,C; scanf("%c%c%c",&A,&B,&C); printf("%c%c%c\n",A+32,B+32,C+32); return 0;}
阅读全文
摘要:#includeint main(){ char b; scanf("%c",&b); if(b>='A'&&b96&&b<123) printf("%c\n",b-32); return 0;}
阅读全文
摘要:#include#includeint main(){double sum=0.0;int a;int i=1;while(i<11){ a=pow(-1,i+1); sum=sum+(a*(1.0/i)); i++;}pr...
阅读全文
摘要:#includeint main(){ int i,j; for(i=1;i<=6;i++) { for(j=1;j<=i;j++) printf("*"); printf("\n"); }}
阅读全文
摘要:#includeint main(){ int a,b; scanf("%d%d",&a,&b); printf("a-b=%d",a-b); return 0;}
阅读全文
摘要:#includeint main(void){ double a=22222.22222; printf("a=%0.5f\n",a); return 0;}
阅读全文
摘要:#include int main(void){ printf("hello world"); return 0;}
阅读全文
摘要:#include #include int main(){ int a, i, c, b, t; scanf("%d", &a); t = a; i=0; while (t > 0) { t = t /...
阅读全文
摘要:#include int main() { char ch; scanf("%c",&ch); printf("%d",ch); return 0; }
阅读全文
摘要:#includeint main(void){ int i=5,y; y=i++*++i; printf("i=%d\n",i); printf("y=%d\n",y); i=5; y=i++*i++; printf("i=%d\n",i); printf("...
阅读全文
摘要:#include int main(){ int a,b; scanf("%d%d",&a,&b); printf("%d", a+b); return 0;}
阅读全文
摘要:#includeint main(){ int i,j; for(i=1;i<=6;i++) { for(j=1;j<=6-i;j++) { putchar(' '); } for(j=1;j<=2*i-1;j++) printf("*"...
阅读全文
摘要:#includeint main(){ int num1,num2,num3,temp; scanf("%d%d%d/n",&num1,&num2,&num3); sort(num1,num2,num3); return 0;}int sort(int x...
阅读全文
摘要:#includeint main(){ int num1,num2,num3,temp; scanf("%d%d%d/n",&num1,&num2,&num3); sort(num1,num2,num3); return 0;}int sort(int x,i...
阅读全文
摘要:#includeint main(){ int num1,num2,num3,temp; scanf("%d%d%d/n",&num1,&num2,&num3); if (num2>num1) temp=num2,num2=nu...
阅读全文
摘要:#includeint main(){ int a[5]={1,3,5,7,9},i,*p; for(i=0;i<5;i++) printf("%6d\n",a[i]); for(i=0;i<5;i++) printf("%6d\n",*(a+i)); f...
阅读全文
摘要:#includeint main(){ char A,B,C; scanf("%c%c%c",&A,&B,&C); printf("%c%c%c\n",A+32,B+32,C+32); return 0;}
阅读全文
摘要:#includeint main(){ int a[10],i,sum=0,max,min; float average; for(i=0;ia[i]) min=a[i]; } ...
阅读全文
摘要:#define n 32#includeint main(void){ int i,j,t; int a[n]; for(i=0;ia[j+1]) { t=a[j]; a[j]=a[j+1]; a[j+1]=t; } ...
阅读全文
摘要:#includeint main(void){ int b[10],a[20],i; for(i=0;i<20;i++) scanf("%d",&a[i]); for(i=0;i<10;i++) b[i]=0; for(i=0;i<20;i++) {...
阅读全文
摘要:#includeint main(){ int a[20],i,sum,j,k,b[10]={0,1,2,3,4,5,6,7,8,9}; for(i=0;i<20;i++) scanf("%d",&a[i]); for(k=0;k<10;k++) { s...
阅读全文
摘要:游戏介绍 我们将要制作一款极具挑战性的、不停歇的奔跑者的类型游戏。其中,你可以控制一个名为 Ellio 的外星人, 他在自己的玩具砖块的帮助下(这些积木可能是漂浮在地面之上的),试图调整地球对他的重力作用。 在游戏 Ellio 中,人物角色将会不停...
阅读全文
摘要:前情提要 可以在本地先创个具体的文件夹目录 代码实现 #include #include#include#define MaxSize 100//这里是目录底下最多的文件数量设置,文件数量设置要多余等于实际情况,不然不能全部出来i...
阅读全文
摘要:前情提要 文件内容结构 本地文件夹 代码实现 #include #include#include#define MaxSize 100//这里是目录底下最多的文件数量设置,文件数量设置要多余等于实际情况,不然不能全部出来int Function(...
阅读全文
摘要:前期题要 构造思想,文件采用左兄弟,右孩子的想法进行构造。 代码实现 #include#include#include#include#define MaxSize 100typedef char ElemType;int flag=0;typedef...
阅读全文
摘要:前情提要 请为用于通信的电文中的字母进行赫夫曼编码。如各个字母在电文中出现的频率分别为0.05,0.29,0.07,0.08,0.14,0.23,0.03,0.11。试为这8个字母设计哈夫曼编码。 通信的电文中的字母一般是a,b,c,d,e,f,g,h...
阅读全文
摘要:前情提要 按先序次序输入二叉树中结点的值(一个字符),`0`表示空树,生成二叉树的二叉链表存储结构, a为指向根结点的指针。 然后按中序顺序遍历二叉树。 算法思想:先访问左子树,再访问根结点,最后访问右子树 实验数据:abc00de0g00f000(...
阅读全文
摘要:前情提要 程序采用cpp文件,实现中序线索化二叉树,采用递归和非递归两种方式输出线索中序序列。 函数操作 TBTNode *CreateTBTNode(char *str);//根据str串创造线索化二叉树 void DispTBTNode(TBTN...
阅读全文
摘要:getKeyChar(): char 返回这个事件中和键相关的字符 getKeyCode(): int 返回这个事件中和键相关的整数键 keyPressed(e: KeyEvent) ...
阅读全文
摘要:游戏界面 第一代游戏操作 游戏根据键盘按键👆 、👇来控制挡板移动,把白色框弹回去,就加分;没接到白色框,就扣分。 蓝色区域与红色区域的挡板方向相反。 单人操作。 代码组成 游戏链接 一个球bycf.rar-其...
阅读全文
摘要:前情提要 设字母映射表为: a b c d e f g h i j k l m n o p q r s t u v w x y z n g z q t c o b m u h e l k p d a w x f y i v r s j 测试数据:en...
阅读全文
摘要:函数操作 采用简单匹配算法求子串t在主串s中的位置采用KMP算法求子串t在主串s中的位置采用改进的KMP算法求子串t在主串s中的位置 代码实现 #include#include#include#define MaxSize 100typedef int...
阅读全文
摘要:函数操作 Status StrAssign(HString &T, char * chars)//生成一个其值等于串常量chars的串T int StrLength(HString S)//返回S的元素个数,称为串的长度 int StrCompare(...
阅读全文
摘要:题目 定义一个接口Usb,里面有工作方法work(),定义一个UsbMouse类和UsbKeyborder类,让两个Usb设备实现Usb接口。 编写测试程序,创建一个Usb类型的数组,数组元素为UsbMouse对象和UsbKeyborder对象,循环遍历数...
阅读全文
摘要:题目 请根据UML图和下列要求编写程序: (1)定义一个名为Shape的抽象类,该类有一个抽象方法getArea()。 (2)定义一个名为Circle的圆形子类,该类的数据成员有半径(radius),实现父类方法getArea()用于计算圆形的面积。equa...
阅读全文
摘要:题目 在数列 a_1, a_2, …, a_n中,定义两个元素 a_i 和 a_j 的距离为 |i-j|+|a_i-a_j|,即元素下标的距离加上元素值的差的绝对值,其中 |x| 表示 x 的绝对值。给定一个数列,请问找出元素之间最大的元素距离。 代码 先输...
阅读全文
摘要:修饰符 private,default,protected,public,static,final,abstract; 非访问修饰符 final修饰符 final 变量 final 表示"最后的、最终的"含义,变量一旦赋值后,不能被重新赋值。被 final...
阅读全文
摘要:前情提要 代码文件采用cpp文件 代码 #include#include#define MaxSize 100typedef struct{ char data[MaxSize]; int length;}SqString;void StrAssign(...
阅读全文
摘要:Rectangle类代码 public class Rectangle extends GeometricObject{ private double width; private double height; public Rectangle()...
阅读全文
摘要:步骤 参考代码 package com;//GdufStudent/** * 这个程序定义了一个学生类,类中有一个公共属性、两个私有属性和七个方法,可以调用introduce()方法,显示学生的姓名、年龄和性别 * @autho...
阅读全文
摘要:获取 可以通过浏览器访问Oracle公司Java SE的下载页面,来获取JDK参考文档 使用 使用某个类或者某个类中的方法,第一步是导入这个包或者这个类 例如导入 Math类用"import java.lang.Math;",导入java.lang包用"im...
阅读全文
摘要:题目 该类包含: 一个名为elements的int[ ]类型的数据域,保存队列的int值 一个名为size的数据域,保存队列的元素个数 一个构造方法,使用默认的容量8创建一个Queue对象 方法enqueue(int value),用于将value加入到队列...
阅读全文
摘要:前情提要 代码使用cpp文件,使用链队。 在病人排队过程中,主要重复两件事: (1)病人到达诊室,将病历交给护士,排到等待队列中候诊。 (2)护士从等待队列中取出下一位病人的病历,该病人进入诊室就诊。 要求模拟病人等待就诊这一过程。程序采用菜单方式,其选项及...
阅读全文
摘要:import java.util.*;public class FindNearestPoint { public static void main(String[] args){ Scanner buf=new Scanner(Syste...
阅读全文
摘要:前情提要 纯c版本,它可以无限输入,输出;不断进行表达式计算,退出就直接把控制台关掉就好。 #include#include#include#define max 100typedef struct{ double data[max]; int top;}St...
阅读全文
摘要:前情提要 纯c版本,#号代表终止操作 #include#include#include#define maxsize 100typedef int status;//使后面可以使用status类型,用来表示成功或失败状态#define ERROR -1#de...
阅读全文
摘要:前情提要 cpp文件 对16进制转换,本文提供2种 本代码可支持,10进制转换为任意进制的数(但不支持数字转变为字母) 可以加入一些负责转换字母的函数,例如下个代码当中的mode16函数,就是负责将10、11、12、13、14、15转换为a、b、c、d、e、f...
阅读全文
摘要:前期提要 本次代码纯c语言,可以支持输入两个多项式的项式、系数、指数。 #include#includetypedef struct arrays//定义存放多项式的数组类型{ double coef;//系数 int exp;//指数}narray;ty...
阅读全文
摘要:本次代码是纯c语言版本的 #include#includetypedef struct//定义存放多项式的数组类型{ double coef;//系数 int exp;//指数}narray[10];typedef struct pnode//定义单链表节点类...
阅读全文
摘要:代码 Void main() { Stack S;Char x,y; InitStack(S); x='c';y='k'; push(S,x);push(S,'a');push(S,y); ---(1) po...
阅读全文
摘要:代码支持实现初始化、栈空、栈满、取栈顶、进栈、出栈。 代码 #include#include#include#define maxsize 100typedef int status;//使后面可以使用status类型,用来表示成功或失败状态#define ...
阅读全文
摘要:代码支持实现初始化、栈空、栈满、取栈顶、进栈、出栈。 代码分为2部分,一个函数部分,一个主函数。 函数部分 #include#include#define maxsize 100typedef struct{ char data[maxsize];//栈 i...
阅读全文
摘要:顺序栈的基本函数 初始化 入栈 出栈 取栈顶元素 需要注意的是,本文代码采用了c++的一些语法,得使用cpp文件,才能运行成功。 代码 #include#include#include#define maxsize 100typedef int statu...
阅读全文
摘要:#include #include #include typedef int ElemType;typedef struct LNode{ ElemType data; struct LNode *next;}LNode,*LinkList;voi...
阅读全文
摘要:#include#include#includetypedef struct node{ int data;//数据 int length;//长度 struct node *next;}Node,*LinkList;//删除超过范围的内容void deLi...
阅读全文
摘要:题目背景 战争已经进入到紧要时间。你是运输小队长,正在率领运输部队向前线运送物资。运输任务像做题一样的无聊。你希望找些刺激,于是命令你的士兵们到前方的一座独木桥上欣赏风景,而你留在桥下欣赏士兵们。士兵们十分愤怒,因为这座独木桥十分狭窄,只能容纳 11 个人通过...
阅读全文
摘要:目录 基本介绍 命令总览 流程 开局操作 后续操作 cmdscan filescan dump hashdump printkey pslist pstree hivelist getsids 基本介绍 Volatility是一...
阅读全文
摘要:题目 选择一种线性表实现方式(顺序表或单链表),实现如下线性表应用: 要求:输入n个学生的信息(姓名,性别,学号,成绩),实现功能: 功能1:查找某个学号为×××的学生; 功能2:添加一名学生的信息(姓名,性别,学号,成绩); ...
阅读全文
摘要:题目 选择一种线性表实现方式(顺序表或单链表),实现如下线性表应用: 要求:输入n个学生的信息(姓名,性别,学号,成绩),实现功能: 功能1:查找某个学号为×××的学生; 功能2:添加一名学生的信息(姓名,性别,学号,成绩); ...
阅读全文
摘要:测试数据 A17(x)=7+3x+9x8+5x17 B8(x)=8x+22x7-9x8 c语言版本 #include#include#define MAX 20typedef struct//定义存放多项式的数组类型{ double coef;//系数 in...
阅读全文
摘要:import java.util.*;public class zuoye9_27 { public static void main(String[] args) { String str; int i=0; ...
阅读全文