2012年3月30日
摘要: exp3-5.cpp//文件名:exp3-5.cpp#include<stdio.h>#define M 4 //行数#define N 4 //列数#define MaxSize 100 //栈最多元素的个数int mg[M+2][N+2]={ {1,1,1,1,1,1},{1,0,0,0,1,1}, {1,0,1,0,0,1},{1,0,0,0,1,1}, {1,1,0,0,0,1},{1,1,1,1,1,1}};struct{ int i,j,di;}stack[MaxSize],path[MaxSize]; ... 阅读全文
posted @ 2012-03-30 09:48 C's 阅读(178) 评论(0) 推荐(0) 编辑
  2012年3月28日
摘要: #include<iostream.h>#include<string.h>class student{private: char sex,name[20]; int age; long no;public: void setstu(char*,long,char,int); void showstu(student);};void student::setstu(char* m,long x,char s,int n){ strcpy(name,m);no=x;sex=s;age=n;}void student::showstu(student x){ ... 阅读全文
posted @ 2012-03-28 20:57 C's 阅读(149) 评论(0) 推荐(0) 编辑
摘要: #include<iostream.h>#include<string.h>class person{ public: char m_strname[20]; long m_ID; person(char *strname,long ID) { strcpy(m_strname,strname); m_ID=ID; } static long getID(person); static char* GetName(person);};long pe... 阅读全文
posted @ 2012-03-28 20:24 C's 阅读(239) 评论(0) 推荐(0) 编辑
摘要: #include<iostream.h>class time{private: int hour,minute,second;public: void settime(int h,int m,int s) { hour=(h>=0&&h<24)?h:0; minute=(m>=0&&m<60)?m:0; second=(s>=0&&s<60)?s:0; } void showtime() {cout<<hour<<':'<<minute<&l 阅读全文
posted @ 2012-03-28 18:02 C's 阅读(185) 评论(0) 推荐(0) 编辑
  2012年3月27日
该文被密码保护。 阅读全文
posted @ 2012-03-27 15:50 C's 阅读(3) 评论(0) 推荐(0) 编辑
  2012年3月21日
摘要: View Code /*用结构体数组编写候选人得票统计程序:设有3个候选人,5个选民,每个选民只能选一个候选人,不考虑弃权情况,要求输出每个候选人的得票结果。提示:1. 定义结构体数据类型,其中包括放候选人姓名的变量和放选票的变量。2. 主程序中定义3个结构体类型变量并初始化(候选人姓名、最初选票数为0)。3. 循环投票,注意结束条件。4. 选票输入提示。5. 输入候选人名。6. 判断人名,并增加候选人票数。7. 循环结束后输出候选人得票数。*/#include<stdio.h>#include<string.h>struct houxuanren{ ... 阅读全文
posted @ 2012-03-21 20:41 C's 阅读(1823) 评论(0) 推荐(0) 编辑
摘要: View Code /*1.编写一个函数print,打印一个学生的成绩数,该数组中有5个学生的数据记录,每个记录包括num、name、sore[3],用主函数输入这些记录,用print函数输出这些记录。*/#include<stdio.h>#include<string.h>#define N 5 struct student {char num[6]; char name[8]; int score[3]; }stu[N]; void print(struct student stu[N]) { int i,j;for(i=0;i<N;i++){ ... 阅读全文
posted @ 2012-03-21 19:52 C's 阅读(306) 评论(0) 推荐(0) 编辑
摘要: View Code /*10.4数组中有10个整数,使前面各数顺序向后移m个位置,最后m个数变成前面m个数,见图。写一函数:实现以上功能,在主函数中输入数m(m<10)和输出调整后的10个数。*/#include<stdio.h>#include<string.h>#define N 10 void shift(float *p,int x){ float a[N]={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},*q,*o; int i; o=a; q=p; for(i=0;i<x;i++) *(q+N-x... 阅读全文
posted @ 2012-03-21 19:28 C's 阅读(418) 评论(0) 推荐(0) 编辑
  2012年3月9日
该文被密码保护。 阅读全文
posted @ 2012-03-09 16:23 C's 阅读(1) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2012-03-09 11:06 C's 阅读(5) 评论(0) 推荐(0) 编辑