??????--EXCEL???? - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

??????--EXCEL????

Description:

Title: PowerPoint Author: TKS Last modified by: Created Date: 8/5/2003 9:26:08 AM Document presentation format: – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 28
Provided by: TKS5
Category:
Tags: excel | chengdu

less

Transcript and Presenter's Notes

Title: ??????--EXCEL????


1
????
(????)
??????--EXCEL????
--????????
??????
????????????
2
??? ?????(1)
???????????????????????????????????????????????
????????????????????????
???????????????????????????????????????????????
???
????????????????????????????????? ??????
3
?
??????--EXCEL????(1046)
Excel?????????????????????????????? Input ????????
?????????????1??????? N (lt100000) ? C,?? N
??????,C ???????????? N?,????????????????????(6???
,????????????)???(???8???????????)???(???0,
100????)??,??????1????????? N0
?,??????,?????????? Output ???????,????1?"Case
i",?? i ????????(?1??)???? N ?????????????,??
C1 ?,???????? C2?,????????????? C3
?,?????????? ????C2??C3???,????????????????,???
????????? ????????
0815
4
8.1 ????????
C???????????????????????????????????,?????????
???????,??????????int?char?float?double?bool??????
C?????????????,???????
??(struct)???(enum)???(union)(?????)??(class)?
?????????????
8.2 ????? 1?????? ??????,???????????????????
????,????????????????????
0815
5
?????????????????????????????
num name sex age score addr
070101 Li Ming M 19 96.5 Chengdu
int num
?????????????,????????????????(???)?????
char name20
char sex
C?????????????????????????????????,????????
??????????(structure)?
int age
float score
char addr30
0815
6
2????????
(1) ?? ???????,???????????,????????????
?????????????????
(2) ??????????????
?
struct lt?????gt lt?????1gt lt???1gt lt?????2gt
lt???2gt lt?????ngt lt???ngt
struct student int num char name20
char sex int age float score char
addr30

0815
7
3???????
? struct????,????,??????????? ?
student????????????????,???????,???????,??????????
???? ? ???????????,?????????????????????????
? ???????????????????????,?????????????
struct student int num char name20 char
sex int age float score char addr30
? ????????????????????????,???????????,??????????
??????? ? ?????????????,???????????,?????????????
???? ? ???????????????,???????????????????
0815
8
8.3 ???????????
1??????????? (1) ???? struct lt?????gt lt???gt
lt?????gt, ?????????????????? (2)
????????????
? ??????????
struct student int num char name20
float score
student stu1,stu2
??????
??????
10101 Zhang 92
10102 Li 97
stu1
stu2
??????????,????????????
sizeof(stu1)
4
20
4
28
0815
9
? ???????????????
(????????)
struct unsigned int num char name20
char sex int age float score char
add30 stu1,stu2,stu3
struct lt?????1gt lt???1gt lt?????2gt lt???2gt
lt?????ngt lt???ngt
? ?????????????
struct student unsigned int num char
name20 char sex int age float score
char add30 stu1,stu2,stu3
struct ???? lt?????1gt lt???1gt lt?????2gt lt???2gt
lt?????ngt lt???ngt ?????
0815
10
2??????????
??,???????????????? struct student unsigned
int num char name10 char sex int age
float score char add20 stdnt110101,ZhangX
i,M,18,90.5,Shanghai, stdnt210102,WangLi
,F,19,88.3,Beijing ????????? struct
student stdnt310103,LiBin,M,17,79.9,HuBei
num
name
sex
age
score
add
0815
11
8.4 ???????
include ltiostreamgt using namespace std struct
student unsigned int num char name20 char
sex int age float score
1?????????? ???????????????????
?1 ????????? C18_1
int main(void) student s110101,WangLi,
M,18,89.5,s2 s2s1
printf(student1u,s,c,u,5.2f\n,s1.num,
s1.name,s1.sex,s1.age,s1.score)
printf("student2u,s,c,u,5.2f\n",s2.num,
s2.name,s2.sex,s2.age,s2.score) return 0
0815
12
???? stdnt170101,ZhangXi,M,18,90.5,Shanghai

2??????????????????????
(1) ???? ?????.??? .??????,?????????????
?
struct student int num char name20
float score stu1,stu2
stu1.num70101 stu1.score95 stu1.name
"Li Ming"
strcpy(stu1.name,"Li Ming")
(2) ?????????????????????
printf("dsf", stu1)
cingtgtstu1
0815
13
????????????????????
printf("dsf",stu1.num,stu1.name,stu1.score)
cingtgtstu1.num
gets(stu1.name)
(3) ?????????(??????),?????????,???????????(??????
????????)?
(4) ??????????????????????????????????(??????????
?)?
stu2.numstu1.num strcpy(stu2,name,stu1.name) st
u2.scorestu1.score
stu2stu1
void fun(student px)
fun(stu1)
??1 ??????? ??????????,?????????????????????
?????????????
0815
14
1?????
struct date int day int month int
year
struct student int num char name10
char sex int day int month int year
char addr20
struct student int num char name10
char sex date birthday char addr20
sizeof(struct student)?
0815
15
2?????
???????????????,???????????,??????????????????
????????????????? ? student stu1 ?
stu1.birthday.year1989 3????1 ?????????
include ltiostreamgt using namespace std struct
Date int month int day int year
struct Person char name20 char sex Date
birthday unsigned long num
0815
16
???1 ?????????? C18_2
int main(void) Person p1"WangLi",'M',12,15,1992
,111000222 Person p2 p2p1
printf("zhangs,c,d-d-d,lu\n",p1.name,p1.sex
, p1.birthday.month,p1.birth
day.day, p1.birthday.year,p1
.num) printf("zhangs,c,d-d-d,lu\n",p2.nam
e,p2.sex,
p2.birthday.month,p2.birthday.day,
p2.birthday.year,p2.num) return 0
0815
17
??2 ????
????????????????,?????????????? ??2.1
??????????? ????????????????????? 1???????
(1) ???????,???????
(2) ??????????????? struct student int num
float score stu34
struct student int num float score
student stu34
0815
18
(3) ????????
2????????? (1) ????
struct int num float score stu30
struct ????? lt?????1gt lt???1gt lt?????2gt
lt???2gt lt?????ngt
lt???ngt ????????0?????, ????1?????,

0815
19
(2) ??
struct studentunsigned int num char
name16 char sex int age float score
char addr30 student stu370101,ZhangXi"
,'M',18, 90.5,103 Bejing Road,
70102,WangLi",F',19, 88.3,130
Shanghai Road, 70103,LiHong",M',17,
79.9,"1010 Zhongshan Road"
stu0
stu1

stu2
0815
20
??2.2 ??????????
1?????????? ????????(??????)?????????,????????
??????????????????????,??????????? ? student
stu3,student1 ???????????
student1stu0 stu0stu1
stu1student1 2????????????
??????????????????????????????? stui.num
0815
21
???2 ??3???????????? C18_3
include ltiostreamgt using namespace std define
stunum 3 struct studtype char name16 long
num int age char sex float score
int main(void) struct StudType stustunum int
i for(i0iltstunumi) printf("enter all
data of stud\n",i)
gets(stui.name) cingtgtstui.num
cingtgtstui.agegetchar() cingtgtstui.sex
cingtgtstui.scoregetchar()
0815
22
???2 ??3???????????? C18_3
printf("\nrecord name \t \t num\tage\tsex\tscore\
n") for(i0iltstunumi) printf("d\t-16s-8
dd\t-c\t6.2f\n",i,stui.name,
stui.num,stui.age,stui.sex,stui.score)
return 0
???2 ?????????(????????0???),??????? C18_3_1
0815
23
???3 EXCEL????(1046) C18_4
Excel?????????????????????????????? Input ????????
?????????????1??????? N (lt100000) ? C,?? N
??????,C ????????????N?,????????????????????(6???,
????????????)???(???8???????????)???(???0,
100????)??,??????1?????????N0?,??????,??????????
Output ???????,????1?"Case i",?? i
????????(?1??)???? N ?????????????,?? C1
?,???????? C2?,????????????? C3
?,?????????? ????C2??C3???,????????????????,???
?????????
0815
24
???3 EXCEL????(1046) C18_4
Sample Input 3 1 000007 James 85 000010 Amy
90 000001 Zoe 60 4 2 000007 James 85 000010 Amy
90 000001 Zoe 60 000002 James 98 4 3 000007 James
85 000010 Amy 90 000001 Zoe 60 000002 James 90 0 0
Sample Output Case 1 000001 Zoe 60 000007 James
85 000010 Amy 90 Case 2 000010 Amy 90 000002
James 98 000007 James 85 000001 Zoe 60 Case
3 000001 Zoe 60 000007 James 85 000002 James
90 000010 Amy 90
0815
25
???3 EXCEL????(1046) C18_4
include ltiostreamgt using namespace std struct
stunode char num7 char name9 int
score
struct stunode s100 int main(void) int
n,c,i while(cingtgtngtgtc) if(n0) break
for(i0iltni) cingtgtsi.numgtgtsi.namegtgtsi
.score mysort(s,c,n) printf("Case
d\n",t) for(i0iltni) printf("s
s d\n",si.num,si.name,si.score)
return 0
0815
26
bool cmp(stunode s,int j,int c) if(c1)
return strcmp(sj.num,sj1.num)gt0 if(c2)
if(strcmp(sj.name,sj1.name)0)
return strcmp(sj.num,sj1.num)gt0
else return strcmp(sj.name,sj1.name)gt0
if(c3) if(sj.scoresj1.score)
return strcmp(sj.num,sj1.num)gt0
else return sj.scoregtsj1.score return
true
???3 EXCEL????(1046) C18_4
void mysort(struct stunode s,int c,int n) int
i,j stunode temp for(i0iltn-1i)
for(j0jltn-1-ij) if( ?
cmp(s,j,c)) tempsj sjsj1
sj1temp

0815
27
? ????????????
int separate(char s1) int k,m0,d1
kstrlen(s1)-1 while(kgt0s1k!' ')
mm(s1k-48)d dd10k-- s1k'\0'
return m
?? cingtgtsi.numgetchar() gets(si.name)
si.scoreseparate(si.name)
???4 ???????? C18_4_1
???? C18_4_1.DOC
?
???????
1????? 6086?6087 2???? ??????
Write a Comment
User Comments (0)
About PowerShow.com