GRY-Online.pl --> Archiwum Forum

Program w C

11.01.2009
19:33
smile
[1]

hopkins [ Zaczarowany ]

Program w C

Znajdzie sie jakis milosierny samarytanin, ktory jest pasjonatem programowania i odwali za mnie brudna robote? :) Sesja sie zbliza, a mam ten projekt do oddania i srednio mam czas. Odwdziecze sie za wszelka pomoc! :)
Tresc jest taka:
A database for a library. Write a program that supports the work of a library with a few houndred of readers. The program should hold data for all books currently outside the library: who has them, for how long etc. It shall also find readers who keep their books too long and answer the question who has a specified book

Z gory dziekuje.

11.01.2009
22:27
[2]

hopkins [ Zaczarowany ]

up

12.01.2009
12:30
[3]

hopkins [ Zaczarowany ]

up

12.01.2009
20:32
[4]

hopkins [ Zaczarowany ]

up

12.01.2009
20:39
[5]

Moby7777 [ Generaďż˝ ]

Przestań upować bo nikt Ci nie pomoże. wymagasz trochę za wiele jak za koleżeńską przysługę.

12.01.2009
23:02
[6]

hopkins [ Zaczarowany ]

Moby7777 wiem... Jednak nadzieja matka glupich.
Dobrze mamy cos takiego:
#include<stdio.h>

void lending()‹
char buffer[30];
FILE *p;
p=fopen("titles.txt","at");

printf("Type the title of a hired book ");
scanf("%s",buffer);
fprintf(p,"%s\b ",buffer);

printf("Type the author ");
scanf("%s",buffer);
fprintf(p,"%s\n",buffer);

fclose(p);
p=fopen("names.txt","at");

printf("Type the name of man, who is hiring the book ");
scanf("%s",buffer);
fprintf(p,"%s\b ",buffer);

printf("Type the surname of man, who is hiring the book ");
scanf("%s",buffer);
fprintf(p,"%s\n",buffer);
fclose(p);


int spec_book()‹
char title[60],aux[30],b;
int i,j;
FILE *p;
p=fopen("titles.txt","rt");

printf("Type the title and author of book being searched for ");
scanf("%s",title);

i=1;
while(!feof(p))‹
fscanf(p,"%s",aux);
fscanf(p,"%c");
if(!strcmp(aux,title)) break;
i++;

if(feof(p)) return 1;
j=1;
fclose(p);
p=fopen("surname.txt","rt");

while(j<i-1)‹
fscanf(p,"%c",&b);
if(b=='\n') j++;

fscanf(p,"%s",title);
printf("%s",title);
fclose(p);
return 0;


void too_long()‹


int menu()‹
int x;
printf("What to do?\n1:Lending new book\n2:Who has specified book?\n3:Who keeps a book too long\n4:Exit\n");
scanf("%d",&x);
return x;


int main()‹

int choice;

choice=menu();
while(1)‹
while((choice>4)||(choice<1)) choice=menu();
switch(choice)‹
case 1:
lending();
break;
case 2:
spec_book();
break;
case 3:
too_long();
break;
case 4:
goto sk;

choice=menu();

sk:
return 0;


Co z tym zrobic jeszcze? :)

© 2000-2024 GRY-OnLine S.A.