摘要: 定义一个点类Point,包含2个成员变量x、y分别表示x和y坐标,2个构造器Point()和Point(intx0,y0),以及一个movePoint(intdx,intdy)方法实现点的位置移动,创建两个Point对象p1、p2,分别调用movePoint方法后,打印p1和p2的坐标。[必作题] 阅读全文
posted @ 2023-05-24 18:26 顾白白 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 1.编写一个方法,实现冒泡排序(由小到大),并调用该方法 package seven; public class ddd { public static void main(String[] args) { int x[]= {1,5,7,3,2,9,4}; paixu(x); for(int i= 阅读全文
posted @ 2023-05-16 18:43 顾白白 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 1.给定一个有9个整数(1,6,2,3,9,4,5,7,8)的数组,先排序,然后输出排序后的数组的值。 package www; public class ii { public static void main(String[] args) { int[]a= {1,2,3,4,5,6,7,8}; 阅读全文
posted @ 2023-05-16 18:20 顾白白 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 编写一个简单程序,要求数组长度为5,静态赋值10,20,30,40,50,在控制台输出该数组的值 package www; public class aaa { public static void main(String[] args) { int[]a= {10,20,30,40,50}; in 阅读全文
posted @ 2023-04-17 12:59 顾白白 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1使用for循环计算1-100的和,除了以3结尾的那些数 package www; public abstract class ttt { public static void main(String[] args) { int sum=0; for (int i = 0; i <=100; i++ 阅读全文
posted @ 2023-04-10 19:45 顾白白 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 上机练习 第一题分别使用for循环,while循环,do循环求1到100之间所有能被3整除的整数的和。(知识点:循环语句) for循环 package ddd; public class test2 { public static void main(String[] args) { int num 阅读全文
posted @ 2023-04-01 13:45 顾白白 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 1 输入年份月份,输出该月的天数(闰年2月29天,条件参考上机练习1) package zuoye1; import java.util.Scanner; public class test1 { public static void main(String[] args) { // 输入年份月份, 阅读全文
posted @ 2023-03-25 17:02 顾白白 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 1.定义圆半径,求面积。 package zuoye1; public class test1 { public static void main(String[] args) { double r=5; double area=3.14*r*r; System.out.println("半径是5, 阅读全文
posted @ 2023-03-20 20:33 顾白白 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,统计字符串中大写字母的个数。 #include<stdio.h>main(){char str[20];int i,cnt;cnt=i=0;gets(str);while(str[i]!='\0'){if(str[i]>='A'&&str[i]<='Z')cnt++;i++;}prin 阅读全文
posted @ 2021-11-25 21:50 顾白白 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 1.定义一个含有8个储存单元的实行数组,从键盘上接收数,然后逆序输出。 #include<stdio.h>main(){double m[8];int i;for(i=0;i<=7;i++)scanf("%lf",&m[i]);for(i=7;i>=0;i--)printf("%f",m[i]);} 阅读全文
posted @ 2021-11-25 21:47 顾白白 阅读(8) 评论(0) 推荐(0) 编辑