- Posts: 816
- Thank you received: 0
Το GameWorld.gr επιθυμεί να προσλάβει Forum Moderators.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
#include <stdio>
#include <stdlib>
float ipologismos_dikti_mazas_somatos(float *,float *);
float square(float *);
void elegxos_barous(float *);
void elegxos_ipsous(float *);
void writeOnFile(FILE *,float *);
int main(void)
{ float baros,ipsos,deiktis;
char eksodos;
char *name;
name=(char *)malloc(sizeof(char)*40);
printf("Ena programmataki pou ipologizei ton dikti mazas somatos kai malista eksagei ta apotelesmata se ena txt arxeio.\n\n");
puts("To arxeio poy tha sas enimeroni peretero gia ton deikti mazas somatos tha ginete output se path tis epilogis sas");
puts("");
puts("");
printf("\nParakalo eisagete to somatiko sas baros se kg:");
elegxos_barous(&baros);
printf("\nAfou tora eisagate to baros sas doste to ipso sas se metra:");
elegxos_ipsous(&ipsos);
deiktis=ipologismos_dikti_mazas_somatos(&baros,&ipsos);
printf("\nO deiktis mazas somatos einai %.2f \n",deiktis);
puts("Dose to path pou tha itheles na apothikeftei to arxeio opos kai to onoma tou arxeiou");
scanf("%s",name);
puts("Gia perissoteres plirofories anatrekste sto .txt file poy dimiourgithike sto desktop sas");
FILE *arxeio_gia_grapsimo;
arxeio_gia_grapsimo=fopen(name,"w");
//Εφοσον αυτο το αρχείο δεν θα υπάρχει θα δημιουργείται.Αυτο θέλουμε άλλωστε,να δημιουργείται αναφορά για τον δείκτη μαζας
//σώματος
fprintf(arxeio_gia_grapsimo,"O deiktis mazas somatos sas einai %.2f\n\n",deiktis);
writeOnFile(arxeio_gia_grapsimo,&deiktis);
if(arxeio_gia_grapsimo==NULL)
{
puts("Strabose i dimiourgia toy txt arxeiou.");
exit(1);
}
return 0;
}
/*################################################ ΣΥΝΑΡΤΗΣΕΙΣ #################################################################*/
//Δήλωση συνάρτησης που υπολογίζει το τετράγωνο ενος αριθμού.
float square(float *x)
{
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.