摘要:
定义一个点类Point,包含2个成员变量x、y分别表示x和y坐标,2个构造器Point()和Point(intx0,y0),以及一个movePoint(intdx,intdy)方法实现点的位置移动,创建两个Point对象p1、p2,分别调用movePoint方法后,打印p1和p2的坐标。[必作题] 阅读全文
摘要:
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= 阅读全文
摘要:
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}; 阅读全文
摘要:
编写一个简单程序,要求数组长度为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 阅读全文
摘要:
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++ 阅读全文
摘要:
上机练习 第一题分别使用for循环,while循环,do循环求1到100之间所有能被3整除的整数的和。(知识点:循环语句) for循环 package ddd; public class test2 { public static void main(String[] args) { int num 阅读全文
摘要:
1 输入年份月份,输出该月的天数(闰年2月29天,条件参考上机练习1) package zuoye1; import java.util.Scanner; public class test1 { public static void main(String[] args) { // 输入年份月份, 阅读全文
摘要:
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, 阅读全文
摘要:
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 阅读全文
摘要:
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]);} 阅读全文