摘要:
#includeusing namespace std;void sort(int *p,int n);int main (){int a[10],*p=a;for(p=a;pcin>>*p;p=a;sort(p,10);for(p=a;pcout<<*p<<" ";cout<<endl;return 0;}void sort(int *p,int n){int i,k,j,t;for(i=0;i{k=i;for(j=i+1;jif(*(p+j)<*(p+k))k=j;t=*(p+k);*(p+k)=*(p+i);*(p 阅读全文
摘要:
#include#include#includeusing namespace std;#define LIST_INIT_SIZE 100#define LISTINCREMENT 10#define ERROR 0#define OK 1typedef struct LNode{int data; struct LNode *next;}LNode,*LinkList;void CreatList_L(LinkList &L,int n){LinkList p;L=(LinkList)malloc(sizeof(LNode));//cout<<"******* 阅读全文
摘要:
//整数交换#includeusing namespace std;void change1(int &a,int &b);void change2(int *p1,int *p2);void change3();int a,b;int main(){int *p1,*p2;p1=&a;p2=&b;cout<<"请输入两个整数:";cin>>a>>b;cout<<"利用引用将两数进行交换"<<endl;change1(a,b);cout<<a<& 阅读全文
摘要:
//调用函数排序#include#includeusing namespace std;int main(){int arr[1000],n;cout<<"请输入你想排序的数的个数:";cin>>n;cout<<"请输入"<<n<<"个数:"<<endl;for(int i=0;icin>>arr[i];sort(arr,arr+n);for(i=0;i{if(i%5==0) cout<<endl; cout<<arr[i]&l 阅读全文
摘要:
//冒泡排序#includeusingnamespacestd;voidsort0(intarr[],intn);intmain(){intarr[1000],n;cout<<"请输入你想排序的数的个数:";cin>>n;cout<<"请输入"<<n<<"个数:"<<endl;for(inti=0;icin>>arr[i];sort0(arr,n);for(i=0;i{if(i%5==0)cout<<endl;cout<<arr 阅读全文
摘要:
//选择排序#includeusing namespace std;void sort0(int arr[],int n);int main(){int arr[1000],n;cout<<"请输入你想排序的数的个数:";cin>>n;cout<<"请输入"<<n<<"个数:"<<endl;for(int i=0;icin>>arr[i];sort0(arr,n);for(i=0;i{if(i%5==0) cout<<endl; cout& 阅读全文
摘要:
package zzz;import javax.swing.JOptionPane;public class llyytt {public static void main(String[] args) {// TODO Auto-generated method stubint m1,m2,sum=0;String i=JOptionPane.showInputDialog(null,"Enter an number:n,0int intValue=Integer.parseInt(i);while(intValue!=0){m1=intValue;sum=sum+m1;intV 阅读全文
摘要:
package zzz;import javax.swing.JOptionPane;import java.util.*;public class llyytt {public static void main(String[] args) {Scanner input=new Scanner(System.in);char grade;String num=JOptionPane.showInputDialog(null,"请输入一個分数:","梁燕婷",JOptionPane.QUESTION_MESSAGE);int aa=Integer.par 阅读全文
摘要:
package zzz;import javax.swing.JOptionPane;public class llyytt {public static void main(String[] args) {// TODO Auto-generated method stubString year=JOptionPane.showInputDialog(null,"请输入一个年份","梁燕婷",JOptionPane.QUESTION_MESSAGE);int year1=Integer.parseInt(year);String mouth=JOpti 阅读全文
摘要:
package zzz;import javax.swing.JOptionPane;public class llyytt {public static void main(String[] args) {// TODO Auto-generated method stub//String [] aa;String aa=JOptionPane.showInputDialog(null,"Input a number","梁燕婷",JOptionPane.QUESTION_MESSAGE);int aa1=Integer.parseInt(aa);St 阅读全文