Hi everyone... again me... My new project is harder :)
project wants to you how many records do you want to enter (easy part) surname name years doctor and illness. then asks to you 3 choices.
1- ascend surname
2- ascend doc
3- descend year
... and I guess I cant think wright way... anyway... my questions are.....
*-I can find biggest year I can make it descending but how can I put it with other arrays together??
*- How can the project recognize which letter is first?? is it first a or b? how can I find it and again how can I write... (surname and doctors name..)
*- is that way true or am I completly wrong way??????
please help.......
#include<stdio.h>
#include<stdlib.h>
typedef struct myType{
char sname[20];
char name[20];
double old;
char doc[20];
char ill;
}table;
int main(){
int i,j,a,b,k;
double big=0;
printf("Please give the number of data records:\n");
scanf("%d",&a);
table table1[a];
printf("Please give %d patient records in the form:\n",a);
printf("sname---name---y.o.b.---doc---ill:\n");
for (i=0;i<a;i++){
scanf("%s %s %lf %s %s",
&table1[i].sname,
&table1[i].name,
&table1[i].old,
&table1[i].doc,
&table1[i].ill
);}
printf("Please give a sort order code according to menu:\n");
printf(" Surname ascending : 1\n");
printf(" Doctor ascending : 2\n");
printf(" Year-of-birth descending : 3\n");
scanf("%d",&b);
while(b<=3){
switch(b){
//Surname ascending
case 1 :
break;
//Doctor ascending
case 2 :
break;
//Year-of-birth descending
case 3 :
for(k=0;k<a;k++){
if(table1[k].old>=big)
big=table1[k].old;
}
break;}}
if(b>3){
printf("Just enter 1,2 or 3\n");}
system("PAUSE");
return 0;
}