- #include "iostream.h"
- #include "stdlib.h"
- #include "conio.c" // normallement, c'est conio.h mais pas chez moi !
- #include "fstream.h"
-
- FILE *save;
-
- int main()
- {
- clrscr();
- int restart,ON;
- unsigned long int Xfact,i,j;
- char string[40] = "Programme réalisé par Xcept!.";
-
- save = fopen("factorielles.txt", "w+");
- fprintf(save, "\t\t\t%s\n\n\n", string);
- i = 1;
- textcolor(LIGHTGRAY);
- cout << "Donnez la valeur de X dans X! : \n";
- cin >> Xfact;
-
-
-
-
- if (Xfact == 0 )
- {
- textcolor(RED);
- cout << "\n\nLa factorielle de 0, not\202e 0!, vaut 1. C'est une convention\n\n\n";
- switch (restart)
- {
- case 1 : main(); break ;
- case 2 : return 0; break ;
- }
- }
- else
- {
- for (j = 2;j<Xfact+1;j++)
- {
- i *= j;
- fprintf(save,"la factorielle de %i = %u\n",j, i);
- }
- }
-
- textcolor(LIGHTBLUE);
- cout <<"\n\nLa factorielle de ";
- textcolor(RED);
- cout << Xfact ;
- textcolor(LIGHTBLUE);
- cout << " vaut " ;
- textcolor(RED);
- cout << i ;
- cout << "\n\n\n";
-
-
-
- textcolor(BROWN);
- cout << "Recommencer ?\n\t1- oui\n\t2- non\n\n\n";
- cin >> restart;
-
- switch (restart)
- {
- case 1 : main(); break ;
- case 2 : return 0; break ;
- }
- }
#include "iostream.h"
#include "stdlib.h"
#include "conio.c" // normallement, c'est conio.h mais pas chez moi !
#include "fstream.h"
FILE *save;
int main()
{
clrscr();
int restart,ON;
unsigned long int Xfact,i,j;
char string[40] = "Programme réalisé par Xcept!.";
save = fopen("factorielles.txt", "w+");
fprintf(save, "\t\t\t%s\n\n\n", string);
i = 1;
textcolor(LIGHTGRAY);
cout << "Donnez la valeur de X dans X! : \n";
cin >> Xfact;
if (Xfact == 0 )
{
textcolor(RED);
cout << "\n\nLa factorielle de 0, not\202e 0!, vaut 1. C'est une convention\n\n\n";
switch (restart)
{
case 1 : main(); break ;
case 2 : return 0; break ;
}
}
else
{
for (j = 2;j<Xfact+1;j++)
{
i *= j;
fprintf(save,"la factorielle de %i = %u\n",j, i);
}
}
textcolor(LIGHTBLUE);
cout <<"\n\nLa factorielle de ";
textcolor(RED);
cout << Xfact ;
textcolor(LIGHTBLUE);
cout << " vaut " ;
textcolor(RED);
cout << i ;
cout << "\n\n\n";
textcolor(BROWN);
cout << "Recommencer ?\n\t1- oui\n\t2- non\n\n\n";
cin >> restart;
switch (restart)
{
case 1 : main(); break ;
case 2 : return 0; break ;
}
}