// Insertion des librairies
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <math.h>
#include <windows.h>
//Prototypes de fonctions
void menu();
void interets();
void info();
void interetsc1();
void interetsc2();
//Fonction principale
void main()
{
menu();
}
void menu()
{
int choix;
system("cls");
printf("\n\nMenu:\n\n\n");
printf("\t1) Calcul des interets\n");
printf("\t2) Info\n");
printf("\t3) Quitter");
printf("\n\n\tFaites votre choix: ");
for (int err = 0 ; err != 1 ;)
{
choix = getch();
if(choix > 48 && choix < 52)
err++;
}
switch(choix)
{
case 49:
interets();
break;
case 50:
info();
break;
case 51:
system("cls");
exit(1);
break;
}
}
void info()
{
int choix;
system("cls");
printf("Esc - Retour au menu\n");
printf("\n\n\n\n");
printf("\tJosue Clement\n");
printf("\tjosue-clement@bluewin.ch\n");
printf("\thttp://www.3wphp.fr.st");
for (;;)
{
choix = getch();
if(choix == 27)
menu();
}
}
void interets()
{
int choix;
system("cls");
printf("\n\nCalcul des interets:\n\n\n");
printf("\t1) Depuis une somme de base\n");
printf("\t2) Depuis une somme avec interets\n");
printf("\t3) Retour au menu");
printf("\n\n\tFaites votre choix: ");
for (int err = 0 ; err != 1 ;)
{
choix = getch();
if(choix > 48 && choix < 52)
err++;
}
switch(choix)
{
case 49:
interetsc1();
break;
case 50:
interetsc2();
break;
case 51:
system("cls");
menu();
break;
}
}
void interetsc1()
{
int choix;
double somme , interets , temps , somme_interets;
system("cls");
printf("\n\nDepuis une somme de base:\n\n\n");
printf("\tSomme de depart: ");
cin >>somme;
printf("\n\tTaux d'interets (en %%): ");
cin >>interets;
printf("\n\tTemps en jours: ");
cin >>temps;
somme_interets = somme + ((somme * interets * temps)/(36000));
system("cls");
printf("Esc - Retour au menu\n");
printf("\n\n\n");
printf("Somme finale: %10.2f",somme_interets);
for (;;)
{
choix = getch();
if(choix == 27)
menu();
}
}
void interetsc2()
{
int choix;
double somme , interets , temps , somme_interets;
system("cls");
printf("\n\nDepuis une somme avec interets:\n\n\n");
printf("\tSomme totale avec interets: ");
cin >>somme_interets;
printf("\n\tTaux d'interets (en %%): ");
cin >>interets;
printf("\n\tTemps en jours: ");
cin >>temps;
somme = (somme_interets * 36000)/((interets * temps) + 36000);
system("cls");
printf("Esc - Retour au menu\n");
printf("\n\n\n");
printf("Somme de depart: %10.2f",somme);
for (;;)
{
choix = getch();
if(choix == 27)
menu();
}
}