#include <stdio.h>
#include <stdlib.h>
int main()
{
int base,high,area,p;
char choose;
printf("\t\t\t\t#######\n");
printf("\t\t\t\t#Menu'#\n");
printf("\t\t\t\t#######\n");
printf("\n");
printf("a)Calcolo area del rettangolo\n");
printf("\n");
printf("b)Calcolo area del triangolo rettangolo\n");
printf("\n");
printf("c)Calcolo area del quadrato\n");
printf("\n");
printf("d)Calcolo perimetro del rettangolo\n");
printf("\n");
printf("e)Calcolo perimetro del triangolo rettangolo\n");
printf("\n");
printf("f)Calcolo perimetro del quadrato\n");
printf("\n");
printf("La tua scelta = ");
choose=getchar();
switch(choose)
{case 'a':
system("cls");
rect(base,high);
system("PAUSE");
return 0;
case 'b':
system("cls");
tri_rect(base,high);
system("PAUSE");
return 0;
case 'c':
system("cls");
qua (base);
system("PAUSE");
return 0;
case 'd':
system("cls");
retta(base,high);
system("PAUSE");
return 0;
case 'e':
system("cls");
tri_rett(base,high,area);
system("PAUSE");
return 0;
case 'f':
system("cls");
quad(base);
system("PAUSE");
return 0;
}
system("PAUSE");
return 0;
}
int rect(int base, int high )
{
int area;
printf("\t\t\t#############################\n");
printf("\t\t\t#Calcolo area del rettangolo#\n");
printf("\t\t\t#############################\n");
printf("Inserisci la base\n");
scanf("%d",&base);
printf("Inserisci l' altezza\n");
scanf("%d",&high);
area=base*high;
printf("Il risultato e'%d\n",area);
}
int tri_rect(int base, int high )
{
int area;
printf("\t\t\t#################################### ###\n");
printf("\t\t\t#Calcolo area del triangolo rettangolo#\n");
printf("\t\t\t#################################### ###\n");
printf("Inserisci la base\n");
scanf("%d",&base);
printf("Inserisci l' altezza\n");
scanf("%d",&high);
area=base*high/2;
printf("Il risultato e' %d\n",area);
}
int qua (int base)
{
int area;
printf("\t\t\t###########################\n");
printf("\t\t\t#Calcolo area del quadrato#\n");
printf("\t\t\t###########################\n");
printf("Inserisci il lato\n");
scanf("%d",&base);
area=base*base;
printf("Il risultato e' %d\n",area);
}
int retta (int base, int high)
{
int p;
printf("\t\t\t##################################\n ");
printf("\t\t\t#Calcolo perimetro del rettangolo#\n");
printf("\t\t\t##################################\n ");
printf("Inserisci la base\n");
scanf("%d",&base);
printf("Inserisci l' altezza\n");
scanf("%d",&high);
p=(base*2)+(high*2);
printf("Il risultato e' %d\n",p);
}
int tri_rett(int base, int high, int area)
{
int p;
printf("\t\t\t#################################### ########\n");
printf("\t\t\t#Calcolo perimetro del triangolo rettangolo#\n");
printf("\t\t\t#################################### ########\n");
printf("Inserisci il primo lato\n");
scanf("%d",&base);
printf("Inserisci il secondo lato\n");
scanf("%d",&high);
printf("Inserisci il terzo lato\n");
scanf("%d",&area);
p=base+high+area;
printf("Il risultato e' %d\n",p);
}
int quad(int base)
{
int p;
printf("\t\t\t################################\n") ;
printf("\t\t\t#Calcolo perimetro del quadrato#\n");
printf("\t\t\t################################\n") ;
printf("Inserisci il lato\n");
scanf("%d",&base);
p=base*4;
printf("Il risultato e' %d\n",p);
}