- 博客(5)
- 收藏
- 关注
原创 第7章枚举类型输出5种球里去除3种不同球的组合
#include #include//在输出时要用到setw控制符using namespace std;int main(){ enum color {red,yellow,blue,white,black};//声明枚举类型color color pri;//定义colcr类型的变量 pri int i,j,k,n=0,loop;//n是累计不同颜色的组合数
2015-02-09 22:25:00 677
原创 第7章结构体变量小试
用指向结构体变量的指针作实参#include #includeusing namespace std;struct Student{ int num; string name;//用string类型定义字符串变量 float score[3];}stu={1145,"fanxingyue",98,99.5,100};//定义结构体student变量stu并赋初
2015-02-02 17:05:42 437
原创 建立一个简单链表输出同学的学号,姓名
#include using namespace std;struct student{ int num; float score; struct student *next;} a,b,c;int main(){ student *head,*p; a.num=01; a.score=89.5; b.num=02; b.
2015-02-02 12:32:31 5155 1
原创 第7章结构体数组应用举例之候选人票数统计
#include #includeusing namespace std;struct Person{ char name[20]; int count ;} leader[3]= {"Li",0,"Zhang",0,"Sun",0};int main(){ int i,j; char leader_name[20]; for(i=0; i<1
2015-02-02 09:59:11 1707
原创 求素数算法
#include #includeusing namespace std;int main(){ int n,m,k,i; cin>>n; for(m=2; m { k=sqrt(m); for(i=2; i if(m%i==0) brea
2015-02-01 12:27:18 473
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人