All pastes #526020 Raw Edit

Something

public text v1 · immutable
#526020 ·published 2007-05-31 16:58 UTC
rendered paste body
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct
{
	char nom[40];
	char marque[40];
	char modele[40];
	char type[40];
	char moteur[40];
	char carburant[40];
	float consoville;
	float consoautoroute;
}automobiliste;
typedef struct
{
	char nom[40];
	char depart[40];
	char arrivee[40];
	float kmv;
	float kma;
}deplacement;
int main()
{
FILE *fd,*fa,*fr;
deplacement s;
automobiliste p;
char choix,choi;

printf("\n\n\t\t\tEntrer un automobiliste oui(o)/non(n): ");
		scanf("%c",&choix);
if((choix=='o')||(choix=='O'))
{
       if ((fa = fopen("/root/Desktop/test/automo.txt", "a+"))==NULL)
      {
  printf("Cannot open file \n");
}
else 
      printf("Nom automobiliste :");
      scanf("%s",p.nom);
      fprintf(fa,"%s",p.nom);
      printf("la Marque du véhicule :");
      scanf("%s",p.marque);
      fprintf(fa,"\t-%s",p.marque);
      printf("Modéle du véhicule :");      
      scanf("%s",p.modele);
      fprintf(fa,"\t-%s",p.modele);
      printf("type :");
      scanf("%s",p.type);
      fprintf(fa,"\t\t\t\t%s",p.type);
      printf("type Moteur :");
      scanf("%s",p.moteur);
      fprintf(fa,"\t-%s",p.moteur);
      printf("type du carburant :");
      scanf("%s",p.carburant);
      fprintf(fa,"\t-%s",p.carburant);
      printf("Consommation en ville ( nombre de litres / 100km ):");
      scanf("%f",&p.consoville);
      fprintf(fa,"\t-%f",p.consoville);
      printf("Consommation sur autoroute (nombre de litres / 100km):");
      scanf("%f",&p.consoautoroute);
      fprintf(fa,"\t-%f",p.consoautoroute);
      fputc('\n',fa);
      fclose(fa);
}
printf("\n\n\t\t\tEntrer un déplacement oui(o)/non(n) : ");
		scanf("%c",&choi);
if((choix=='o')||(choix=='O'))
{
if ((fd = fopen("/root/Desktop/test/deplacement.txt", "a+"))==NULL)
      {
  printf("Cannot open file \n");
}
else
 printf("Nom automobiliste :");
      scanf("%s",s.nom);
      fprintf(fd,"%s",s.nom);
      printf("ville de départ :");
      scanf("%s",s.depart);
      fprintf(fd,"\t\t\t\t%s",s.depart);
      printf("ville d'arivée :");
      scanf("%s",s.arrivee);
      fprintf(fd,"\t\t\t\t%s",s.arrivee);
      printf("le Nombre de KM en ville :");
      scanf("%f",&s.kmv);
      fprintf(fd,"\t\t%f",s.kmv);
      printf("le Nombre de KM sur autoroute :");
      scanf("%f",&s.kma);
      fprintf(fd,"\t\t%f",s.kma);
      fputc('\n',fd);
      fclose(fd);
}
getchar();
}