-
用选择法对数组中10个整数按由小到大排序
所属栏目:[大数据] 日期:2021-07-06 热度:96
#include stdio.h #include conio.h int main(){ ? void sort(int a[],int n); ? int a[10],i; ? printf("输入数组:n"); ? for(i=0;i10;i++) ? ? scanf("%d",a[i]); ? sort(a,10); ? printf("排序为:n"); ? for(i=0;i10;i++) ? ? printf("%d ",a[i]); ? pri[详细]
-
选择练习:按照成绩的等级输出百分制分数段。成绩的等级由键盘输
所属栏目:[大数据] 日期:2021-07-06 热度:90
#include stdio.h #include conio.h int main(){ ? printf("请输入成绩等级(A(85)、B(70~84)、C(60~69)、D(60)):n"); ? char num; ? scanf("%c",num); ? printf("Your score:"); ? switch(num){ ? ? case'A':printf("85~100n");break; ? ? case'B':printf("[详细]
-
给一个不多于5位的正整数,要求:①求出它是几位数;②分别输出
所属栏目:[大数据] 日期:2021-07-06 热度:50
#include stdio.h #include conio.h int main(){ ? printf("请输入一个不多于5位的正整数:"); ? int num,ge,shi,bai,qian,wan,n; ? scanf("%d",num); ? if(num0num10){ ? ? n=1; ? ? printf("是%d位数,顺序为:%d,逆序为:%d",n,num%10,num%10); ? } ? else if[详细]
-
写一程序,判断某一年是否为闰年
所属栏目:[大数据] 日期:2021-07-06 热度:108
#include stdio.h #include conio.h int main(){ ? printf("请输入年份:"); ? int year,i;; ? scanf("%d",year); ? if(year%4==0){ ? ? if(year%100==0){ ? ? ? if(year%400==0) ? ? ? ? i=1; ? ? ? else ? ? ? ? i=0; ? ? } ? ? else ? ? ? i=1;? ? } ? els[详细]
-
输出1到5的阶乘值(静态变量)
所属栏目:[大数据] 日期:2021-07-06 热度:151
#include stdio.h #include conio.h int main(){ ? int fac(int n); ? int i; ? for(i=1;i=5;i++) ? ? printf("%d!=%dn",i,fac(i)); ? ? getch(); ? ? return 0; }? int fac(int n){ ? static int f=1; ? f=f*n; ? return f; }[详细]
-
输入一个字符,判断它是否为大写字母,如果是,将它转换成小写字
所属栏目:[大数据] 日期:2021-07-06 热度:169
#include stdio.h #include conio.h int main(){ ? char a; ? printf("请输入一个字符:"); ? scanf("%c",a); ? /*法一if((int)a=65(int)a=96) ? ?a=a+32;*/ ? //法二? ? a=(a='A'a='Z')?(a+32):a; ? printf("%c",a); ? getch(); ? return 0; }?[详细]
-
输入3个数a,b,c,要求按由小到大的顺序输出
所属栏目:[大数据] 日期:2021-07-06 热度:152
#include stdio.h #include conio.h int main(){ ? int a,b,c,t; ? printf("请输入3个数:"); ? scanf("%d,%d,%d",a,b,c); ? if(ab){ ? ? t=a;a=b;b=t; ? } ? if(ac){ ? ? t=a;a=c;c=t; ? } ? if(bc){ ? ? t=b;b=c;c=t; ? } ? printf("三个数由小到大为:%d,a[详细]
-
有一个3*4的矩阵,求所有元素中的最大值
所属栏目:[大数据] 日期:2021-07-06 热度:128
#include stdio.h #include conio.h int main(){ ? int max(int a[][4]); ? int array[3][4],i,j; ? printf("输入3*4矩阵:n"); ? for(i=0;i3;i++) ? ? for(j=0;j4;j++){ ? ? ? scanf("%d",array[i][j]); ? ? }? ? printf("n最大值为:%d",max(array)); ? ge[详细]
-
给出三角形的三边长,求三角形面积
所属栏目:[大数据] 日期:2021-07-06 热度:101
#include stdio.h #include conio.h #include math.h int main(){ ? printf("请输入三角形的三边长:n"); ? float x,y,z,s,area; ? scanf("%f,%f,%f",x,y,z); ? if(x+yzx+zyy+zx){ ? ? s=(x+y+z)/2; ? ? area=sqrt(s*(s-x)*(s-y)*(s-z)); ? ? printf("a=%f,b[详细]
-
输入一行字符,分别统计其中英文字母、空格、数字和其他字符的个
所属栏目:[大数据] 日期:2021-07-06 热度:79
#include stdio.h #include conio.h int main(){ ? printf("请输入一行字符:"); ? char num; ? int num_yingwen=0,num_space=0,num_shuzi=0,num_other=0; ? while((num=getchar())!='n'){ ? ? if(num = 'a'num = 'z' || num = 'A'num = 'Z') ? ? ? num_ying[详细]
-
图片处理软件
所属栏目:[大数据] 日期:2021-07-06 热度:86
之前练手开发了一款简单的图片处理软件,开发语言:c# 可实现的功能有: 1.打开文件,保存文件,编辑文件,关闭文件 2.图片特效处理:黑白、底片、锐化、旋转、复原[详细]
-
c# 使用“冒泡”法对数组元素进行排序
所属栏目:[大数据] 日期:2021-07-06 热度:158
结果如图所示 代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp3__冒泡_法排序_数组_ { ? ? class Program ? ? { ? ? ? ? static void Main(string[[详细]
-
c#用foreach打印二维数组中的各元素
所属栏目:[大数据] 日期:2021-07-06 热度:109
代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp3_foreach打印数组元素 { ? ? class Program ? ? { ? ? ? ? static void Main(string[] args) ? ?[详细]
-
c#随机画圆
所属栏目:[大数据] 日期:2021-07-06 热度:99
代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Wind[详细]
-
c#如何绘制树
所属栏目:[大数据] 日期:2021-07-06 热度:52
如图所示,点击Form控件,自动生成一棵树 相关代码如下: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace WindowsFormsApp7 { ? ? public partial[详细]
-
c#-编写简易计算器
所属栏目:[大数据] 日期:2021-07-06 热度:175
设计如图所示。 相关代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Fo[详细]
-
c# 打印杨辉三角(二维不规则数组)
所属栏目:[大数据] 日期:2021-07-06 热度:152
代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp3_打印杨辉三角_二维不规则数组_ { ? ? class Program ? ? { ? ? ? ? static void Main(string[] a[详细]
-
匿名内部类实现线程程序的三种方式
所属栏目:[大数据] 日期:2021-07-06 热度:195
/* ?* 使用匿名内部类,实现多线程程序 ?* 匿名内部类的前提:继承或者接口实现 ?* new 父类或者接口(){ ?* ?? ??? ?重写抽象方法 ?* } ?*/ public class ThreadDemo { ?? ?public static void main(String[] args) { ?? ??? ?//继承方式 XXX extends ?? ?Thr[详细]
-
线程池-1
所属栏目:[大数据] 日期:2021-07-06 热度:146
子类实现接口: public class ThreadPoolRunnable implements Runnable { ?? ?public void run(){ ?? ??? ?System.out.println(Thread.currentThread().getName()+"线程提交任务"); ?? ?} } 测试类: import java.util.concurrent.ExecutorService; import j[详细]
-
线程池-2
所属栏目:[大数据] 日期:2021-07-06 热度:180
子类实现接口: import java.util.concurrent.Callable; /* ?* Callable 接口的实现类,作为线程提交任务出现 ?* 使用方法返回值 ?* ?*/ public class ThreadPoolCallable implements CallableString { ?? ?public String call(){ ?? ??? ?return "abc"; ??[详细]
-
线程实现异步计算-求和
所属栏目:[大数据] 日期:2021-07-06 热度:172
类GetSumCallable实现接口: import java.util.concurrent.Callable; public class GetSumCallable implements CallableInteger { ?? ?public Integer call(){ ?? ??? ?int sum=0; ?? ??? ?for(int i=0;i=100;i++) ?? ??? ??? ?sum=sum+i; ?? ??? ?return su[详细]
-
可变参数
所属栏目:[大数据] 日期:2021-07-06 热度:81
//方法的可变参数 //前提:方法参数数据类型确定,参数的个数任意 //可变参数,本质就是一个数组 public class VarArgumentsDemo { ?? ?public static void main(String[] args) { ?? ??? ?//getSum(); ?? ??? ?int sum= getSum(1,4,35,6,7,8,6); ?? ??? ?Sys[详细]
-
Collections工具类
所属栏目:[大数据] 日期:2021-07-06 热度:58
import java.util.Collections; import java.util.List; import java.util.ArrayList; public class CollectionsDemo { ?? ?public static void main(String[] args) { ?? ??? ?function_1(); ?? ?} ?? ? ?? ?/* ?? ? * Collections.sort静态方法(只针对List[详细]
-
Calendar类及相关方法
所属栏目:[大数据] 日期:2021-07-06 热度:59
import java.util.Calendar; import java.util.Date; /* ?* Calendar类写了静态方法getInstance()直接返回了子类的对象 ?* 不需要直接new子类的对象,通过静态方法直接获取 ?*/ public class CalendarDemo { ?? ?public static void main(String[] args) { ?[详细]
-
练习出生天数
所属栏目:[大数据] 日期:2021-07-06 热度:164
代码如下: import java.text.SimpleDateFormat; import java.util.Date; import java.util.Scanner; //计算活了多少天 public class DateTest { ?? ? ?? ?public static void main(String[] args) throws Exception { ?? ??? ?function(); ?? ?} ?? ? ?? ?p[详细]
