摘要:1 package first; 2 3 public class Employee { 4 private String fName, lName; 5 private long _ID; 6 private int workdays; 7 private fl...
阅读全文
摘要:这道貌似简单的数学题目竟然难倒一百五十万余人。此题在facebook吸引逾342万名全球网友解答,结果有192万多人答对,149万多人答错。有很多同学回答是9,也有很多同学回答是 1 ,还有其他五花八门的答案,那么究竟是多少呢?你认为正确答案是多少呢?System.out.println(6/2*(...
阅读全文
摘要:装箱就是把基础类型封装成一个类。比如把int封装成Integer,这时你就不能把他当成一个数了,而是一个类了,对他的操作就需要用它的方法了。拆箱就是把类转换成基础类型。比如你算个加法什么的是不能用类的,就得把它转换成基本类型,jdk5以后已经可以自动转换了貌似。Integer a=1;//这就是一...
阅读全文
摘要:一个程序一般分为3段:text段,data段,bss段text段:就是放程序代码的,编译时确定,只读,data段:存放在编译阶段(而非运行时)就能确定的数据,可读可写就是通常所说的静态存储区,赋了初值的全局变量和静态变量存放在这个区域,常量也存放在这个区域bss段:定义而没有赋初值的全局变量和静态变...
阅读全文
摘要:1 package first; 2 3 public class TestArgs { 4 5 public static void main(String[] args) { 6 if (args.length != 2) { 7 Syste...
阅读全文
摘要:1 package stu; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 public class TestList { 7 public static void main(String[] args) { ...
阅读全文
摘要:1 package stu; 2 3 public class TestStr { 4 /** 5 * @param args 6 */ 7 public static void main(String[] args) { 8 // 虚拟机是将...
阅读全文
摘要:Assignment* -> Create a structre as follows struct Product { int productid; char productname[10]; float price; int quantity;}* product list is local t...
阅读全文
摘要:Home Assignment:- * Create a menu driven application where you will have 2 types of users to login in Admin and Student *写一个面板程序,要求用户可以Admin和Student两种...
阅读全文
摘要:gets函数和scanf函数都可以作为字符串的输入函数,相同点:都是将从键盘输入的字符串存入数组中,输入完成后要以回车来结束输入。不同点:利用sanf时,在输入过程中碰到空格时系统认为输入结束,并将空格之前的字符作为有效字符存入数组中,并在尾部追加\0作为结束标志。 利用gets时,空格...
阅读全文
摘要:#includevoid isPrime(int n);void main(){int x,n=10;while(n--) { //循环10次printf("Enter number:");scanf("%d",&x);isPrime(x);}}void isPrime(int n){ i...
阅读全文
摘要:#include#include#include //改变颜色需要void selectSort(int a[],int length);void main(){ HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); //引入 int ...
阅读全文
摘要:#includevoid selectSort(int a[],int length);void main(){ int i; float start=0,finish=0; int a[10]={10,15,4,2,5,3,6,9,7,1}; printf("排序前:\...
阅读全文
摘要:#include#includevoid bubbleSort1(int a[],int length);void bubbleSort2(int a[],int length);void main(){ float start=0,finish=0; int a[10]={10,1...
阅读全文
摘要:#includevoid main(){ int a[5]={1,2,3,4,5},i; int *p; p=&a[0]; printf("指针加:\n"); for(i=0;i<5;i++) //addtion { printf("a[%d]...
阅读全文
摘要:#includevoid main(){char name[10];int i=0;printf("Enter your name:");scanf("%s",name);printf("Spell it:");while(name[i]!='\0'){ printf("%c ",name[i...
阅读全文
摘要:Pointers * Pointers are variables * Pointers store only address of the memory location. they do not store a value. * Pointers are declared like :- int...
阅读全文
摘要:#includevoid main (){ int x=0,y=0,z=0; int i,j,k; printf("Enter x,y,z:"); scanf("%d %d %d",&x,&y,&z); int a[x][y],b[y][z],c[x][z]; p...
阅读全文
摘要:#include#includeint x;//保存客户ID(index值)void login(); //登录void menu(); //菜单void deposit(); //存款void withdraw();//取款void check(); //查询void quit();...
阅读全文
摘要:class Assignment-2(use data types,constructs, switch, do while, functions, local variables) Create a Menu Driven Program for a simple bank operation:-...
阅读全文
摘要:#include #include void main(){ int x,i; char str[100]; //gets(st1); printf("Please input a string to find out whether the string is palind...
阅读全文
摘要:#includevoid main(){ int score[4]; int k; char subjects[4][10]={"English","maths","Science","Physics"}; int totalmarks=0; printf("Pleas...
阅读全文
摘要:#includevoid main(){ int id[10]; int n,k; int findid=-1 //表示没有找到 printf("please input the id:\n"); for(int i=0;i<10;i++) { ...
阅读全文
摘要:#includevoid main(){ int a[10]={3,5,6,33,6,78,1,65,42,23}; int min=0,max=0; for(int i=1;ia[max]) max=i; } printf("highest number is:%d,lowest number...
阅读全文