上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页
摘要: #include<iostream>using namespace std;int main(){ int i, *p= &i; i=5; cout<<i<<endl; //5 //cout<<p<<endl; 0012FF44 //cout<<*p++<<endl; 答案5 //cout<<*(p++)<<endl; 答案5 //cout<<(*p)++<<endl; 答案5 //cout<<((*p)++)<<endl; 答案5 阅读全文
posted @ 2012-09-30 11:00 myth_HG 阅读(159) 评论(0) 推荐(0) 编辑
摘要: /*游戏者每次投掷两颗骨子,每个骰子是一个正方体,当骰子停止时,将每个骰子朝上的点数相加,在第一次投掷骰子时,如果所得到的和为7或11,那么游戏者为胜;所得和为2、3或12则输如和为4、5、6、8、9或 10,则此和为游戏者点数。如要想赢得胜利,必须继续投掷骰子,直到取和得自己的点数(也即规则2的点数)为止,如果投掷出的和为7,则为输(并非指第一次投掷的情况下)要求main函数中可选择是继续还是退出游戏,统计并显示游戏获胜次数和输掉次数。*/#include<iostream>#include<cstdlib>#include<ctime>#include& 阅读全文
posted @ 2012-09-28 16:04 myth_HG 阅读(438) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stdio.h>#define MaxLen 20using namespace std;void fun(int a[MaxLen][MaxLen],int n){ int i,j,k=0,m; if(n%2==0) m=n/2; else m=n/2+1; for(i=0;i<m;i++) { for(j=i;j<n-i;j++) { k++; a[i][j]=k; } for(j... 阅读全文
posted @ 2012-09-26 23:07 myth_HG 阅读(300) 评论(0) 推荐(0) 编辑
摘要: packageexercise_4;importjava.util.Scanner;publicclassQ4_29{publicstaticvoidmain(String[]args){Stringwork[]={"Sun","Mon","Tue","Wed","The","Fri","Sat"};intm,i,days[]={31,28,31,30,31,30,31,31,30,31,30,31};Stringmonth[]={"Januar 阅读全文
posted @ 2012-09-22 10:02 myth_HG 阅读(178) 评论(0) 推荐(0) 编辑
摘要: package exercise_4;import java.util.Scanner;public class Q4_34 { public static void main(String[] args) { System.out.println("Enter a number(scissor(0),rock(1),paper(2)): "); Scanner input = new Scanner(System.in); int []count = new int[1000000]; int i = 0; whil... 阅读全文
posted @ 2012-09-22 09:45 myth_HG 阅读(189) 评论(0) 推荐(0) 编辑
摘要: /*本文件要先建一个file3.dat文件,呵呵,我已经很满意了*/#include<iostream>#include<fstream>#include"string"#include"conio.h"using namespace std;struct Score{ int num; char name[30]; char sex; float score;};class Class:public Score{private: void AddData(); void UpdateData(); void SearchData 阅读全文
posted @ 2012-09-16 20:21 myth_HG 阅读(335) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stdio.h>#include<conio.h>#include<fstream>#include<string.h>using namespace std;#define N 20#define Max 100int n=10,m=10;struct Car//汽车路线{ char checi[N];//车次 char Sname[N];//始发站 char Lname[N];//终点站 char type[N];//车辆类型 long length;//里程 double S 阅读全文
posted @ 2012-09-16 20:12 myth_HG 阅读(621) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<iomanip>using namespace std;void main(){ int n,k; cout<<"请输入行数:"<<endl; cin>>k; for(n=1;n<=k;n++) { /*cout.width(20-n); cout.fill(' '); cout<<" "; cout.width(2*n-1); cout.fill('B'); cout<<&quo 阅读全文
posted @ 2012-09-15 10:31 myth_HG 阅读(147) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>using namespace std;void Adjust(int k[],int i,int n){ int j; int temp; temp=k[i]; j=2*i; while(j<=n) { if(j<n&&k[j]<k[j+1]) j++; if(temp>=k[j]) break; k[j/2]=k[j]; j=2*j; } k[j/2]=temp;}void Heapsort(int k[],... 阅读全文
posted @ 2012-09-11 21:09 myth_HG 阅读(420) 评论(0) 推荐(0) 编辑
摘要: //sort快速排序法#include<iostream>#include<algorithm>using namespace std;void Quick(int k[],int s,int t){ int i,j; if(s<t) { i=s;//0表示第一个位置 j=t+1;//j表示第n+1个位置 while(1) { do i++; while(!(k[s]<=k[i]||i==t)); do j--; while(!(k... 阅读全文
posted @ 2012-09-10 17:47 myth_HG 阅读(241) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页