By "active code", Tater basically means anything that ends up in the final executable. That means global variables and functions bodies (as opposed to function prototypes). The proper way to lay out your files (using rmatze's code as a base) is like so:
main.c
Code:
#include <stdio.h>
#include <stdlib.h>
#include "prix.h" // this is just for the prototypes, not the definitions themselves.
int main()
{
int nombreChandail = 0;
double prixL = 0;
double prixC = 0;
double prixTotal = 0;
int recommencer = 0;
double prixX = 0;
do
{
printf("Nombre de chandails : ");
scanf("%d", &nombreChandail);
prixL = prixLivraison(nombreChandail);
printf("\nPrix livrasion : %.2lf$", prixL);
prixC = prixChandail(nombreChandail);
printf("\nPrix chandail : %.2lf$", prixC));
printf("\n\n");
prixTotal = prixT(prixL, prixC);
printf("Prix total : %.2lf$", prixTotal);
// =============================
printf("\n\nRecommencer ?");
printf("\n1. Oui");
printf("\n0. Non\t");
scanf("\n%d", &recommencer);
printf("\n====================\n\n");
}while(recommencer != 0);
return 0;
}
prix.c
Code:
double prixChandail(double prix)
{
return prix * 18;
}
double prixLivraison(double livraison)
{
return livraison * 11;
}
double prixT(double prixLivraison, double prixChandail)
{
return prixChandail + prixLivraison;
}
prix.h
Code:
// all the lines with PRIX_H__ form an include guard
// every header file you ever create should have an include guard
// Read the Wikipedia article for details
#ifndef PRIX_H__
#define PRIX_H__
// these are just function prototypes
// they exist so the compiler can make sure you pass it the right
// number and type of parameters and use the return value correctly
double prixChandail(double prix);
double prixLivraison(double livraison);
double prixT(double prixLivraison, double prixChandail);
#endif // PRIX_H__