October 3, 2008
4.30 am

woot! its 4.30am now , the birds are chirping away and i'm wrecking my brains to find out why i can't seem to crack this last part of my assignment.

here's a glimpse:
/******** #5 Sell and delete car from list ********/
void sell_car(){
CAR *current, *prev;
int found=0;
int key;
char filename[] = "car.txt";
printf("Enter car id to sell: \n");
scanf("%d", &key);
if((fptr = fopen(filename, "a"))==NULL){
printf("Cannot open file\n");
exit(1);
}
else{
if(current==NULL){
printf("List is empty\n");
}
else{
while(!feof(fptr)){
current = (CAR *)malloc(sizeof(CAR));
fscanf(fptr, "%d%s%s%s%d%f\n", &current->id,
current->model,&current->make, current->color,
&current->year, &current->price);

fscanf(fptr,"%d%d%s%s\n", &(current->tech1.cylinders), &current->tech1.tankCapacity,
current->tech1.transmission,current->tech1.driveType);
fscanf(fptr," %s\n", current->extras.extraDetails);

if(key == current->id){
found = 1;
//balance += current->price;

prev->next = current->next;
fprintf(fptr, "%d %s %s %s %d %f\n", current->id, current->model, current->make, current->color,
current->year, current->price);
fflush(stdin);
fprintf(fptr,"%d %d %s %s\n", current->tech1.cylinders, current->tech1.tankCapacity,
current->tech1.transmission,current->tech1.driveType);
fflush(stdin);
fprintf(fptr," %s\n", current->extras.extraDetails);
//printf("Sold. Balance: %.2f\n", balance);
break;
}

}//while
if(found ==0)
printf("No such Car ID\n");
}//else
}//else
}

any help would be greatly appreciated LOL!

2 Comments:

Blogger somebody said...

酒店經紀人,菲梵酒店經紀,酒店經紀,禮服酒店上班,酒店小姐,便服酒店經紀,酒店打工,酒店寒假打工,酒店經紀,酒店經紀,專業酒店經紀,合法酒店經紀,酒店暑假打工,酒店兼職,便服酒店工作,酒店打工經紀,制服酒店經紀,專業酒店經紀,合法酒店經紀,酒店暑假打工,酒店兼職,便服酒店工作,酒店打工,酒店經紀,制服酒店經紀,酒店經紀
,

May 15, 2010 at 8:15 PM  
Blogger sertac kaya said...

vpills v-pills v pills kullananlar v pills yan etkileri v pills işe yarıyormu v pills hakkında yorumlar v pills zararları v pills yorumlar v pills şikayet v-pills zararları v-pills yorum v-pills forum v-pills yan etkileri v-pills kullananlar v-pills kullandım v-pills yorumları

December 4, 2011 at 2:51 AM  

Post a Comment

<< Home