自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 float类型强转为int类型

@Test public void floatToInt(){ float b = 3.14f; float a = 3.89f; System.out.println((int) a); // 3 System.out.println((int) b); // 3 }事实证明:float强转int,是向下取整。

2021-12-09 22:37:22 1403

原创 Js原型与原型链

原型与原型链原型所有函数function都有一个特别的属性prototype:显示原型属性所有实例对象都有一个特别的属性_proto_:隐式原型属性显示原型属性与隐式原型属性的关系函数的prototype:定义函数时被自动赋值,值默认为{},即为原型对象实例对象的_proto_:在创建实例对象时被自动添加,并赋值为构造函数的prototype值原型对象即为当前实例对象的父对象图解原型链所有实例对象都有__proto__属性,它指向的就是原型对象这样通过__

2021-12-07 22:06:43 72

原创 C语言编程---解决CLion多个main函数共存问题

C语言编程—解决CLion多个main函数共存问题在生成的CMakeLists.txt文件中补充下面文件即可。# 遍历项目根目录下所有的 .c 文件file (GLOB files *.c)foreach (file ${files}) string(REGEX REPLACE ".+/(.+)\\..*" "\\1" exe ${file}) add_executable (${exe} ${file}) message (\ \ \ \ --\ src/${exe}.c\

2021-09-14 20:00:42 315

原创 比较大小

public class Maxof10{public static void main(String[] args) {int max =Integer.MIN_VALUE;int[] arr =new int[args.length];//防止数组溢出int i =0;for (String s:args){//输入数值arr[i++] =Integer.parseInt(s);...

2019-12-10 09:01:37 116

原创 倒序输出一个字符串

public class ReverseString{public static void main(String[] args) {Scanner scanner =new Scanner(System.in);String input =scanner.next();//键盘输入任意字符串StringBuffer sb =new StringBuffer(input);int i=0...

2019-12-10 09:00:23 221

原创 封装加减乘除方法

public class Operation1 {// 加法public int add(int x,int y) {return x+y;}//减法public int sub(int x,int y) {return x-y;}//乘法public int mul(int x, int y) {return xy;}//除法public int div(int x,...

2019-12-10 08:57:50 1094

原创 求100-1000的素数

public class zuoye01 {public static void main(String[] args) {int sum = 0;方法一:双重循环for (int i =100; i <= 1000; i++) {//查找100~1000的自然数int j;//同一个作用域只能定义一个jfor ( j = 2; j <=(int)(Math.sqrt(i)...

2019-12-10 08:56:39 740

原创 位运算

public static void main(String[]args) {Scanner scan = new Scanner(System.in);int a = scan.nextInt();//任意输入一个整数int b = 1;for (int i = 0; i < 32; i++) {//循环体,32次循环System.out.print(a&b);a =(...

2019-12-10 08:54:44 63

原创 判断是否是闰年

import java.util.Scanner;public class zuoye02 {public static void main(String[] args) {Scanner scan = new Scanner(System.in);int a = scan.nextInt();//任意输入一个整数if (((a %4 == 0)&&!(a%100 ==0...

2019-12-10 08:53:32 80

原创 求矩阵对角线累加和

ublic class Diangle{public static void main(String[] args) {int[][]a =new int[4][4];// if (args.length<16){// System.out.println(“数字数量不足”);// return;// }int k=0;int sum=0;for (int i=0;i&...

2019-12-10 08:52:36 177

原创 编写程序,模拟掷两个骰子的数字。测试是否只出现[2,12]内的整数,试问这些数字出现的几率相同吗

import java.util.Random;public class RandomSum{public static void main(String[] args) {Random random =new Random();int[] result =new int[11];//[2,12]之间有11个元素,所以定义一个索引为11的一维数组来接收int count =100;//定...

2019-12-10 08:49:52 1935

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除