Logo elrincondelc.com
curso de programación en c
Foros de programación en C
Inicio :: Código fuente

Valoración
0

Libreria "UTILIDAD"

codigo enviada por: leandroleu
copienlo a un archivo de block de notas y en vez de guardarlo en el formato .txt guardenlo como UTILIDAD.H si quieren el manual de funciones pidanlo a mi e-mail. :-)
#ifndef __UTILIDAD_H
#define __UTILIDAD_H

#ifndef __WINDOWS_H
#include <windows.h>     /* <WINDOWS.H> VA SIEMPRE */
#endif  /* __WINDOWS_H */

#ifndef __STDIO_H
#include <stdio.h>      /* HAY FUNCIONES QUE NECESITAN A STDIO.H*/
#endif  /* __STDIO_H_ */

#ifndef __STDLIB_H
#include <stdlib.h>     /* HAY FUNCIONES QUE NECESITAN A STDLIB.H*/
#endif  /* __STDLIB_H */

#ifndef __CONIO_H
#include <conio.h>      /* HAY FUNCIONES QUE NECESITAN A CONIO.H*/
#endif  /* __CONIO_H  */

#ifndef __STRING_H
#include <string.h>     /* HAY FUNCIONES QUE NECESITAN A STRING.H*/
#endif  /* __CONIO_H  */

float areac (float l)                      /*AREA DE UN CUADRADO*/
{
   float areac;
   areac=l*l;                                /*AREA=LADO*LADO*/
   return areac;
}
float perimc (float l)                     /*PERIMETRO DE UN CUADRADO*/
{
   float perimc;
   perimc=l*4;                               /*PERIMETRO=LADO*4*/
   return perimc;
}
float areat (float b, float a)              /*AREA DE UN TRIANGULO*/
{
   float areat;
   areat=(b*a)/2;                           /*AREA=(BASE*ALTURA)/2*/
   return areat;
}
float arear (float l1, float l2)    /*AREA DE UN RECTANGULO O PARALELOGRAMO*/
{
   float arear;
   arear=l1*l2;                              /*AREA=BASE*ALTURA*/
   return arear;
}
float rgl3s (float x, float y, float k)     /*REGLA DE 3 SIMPLE*/
{
   float rgl3s;                            /*SI Y = K*/
   rgl3s=(x*k)/y;                          /*Y  X = ?       X*K */
   return rgl3s;                           /*ENTONCES => ?= --- */
}                                          /*                Y  */

float areatr (float B, float b, float h)  /*AREA DE UN TRAPECIO*/
{
   float areatr;
   areatr=(B+b)*h/2;        /*AREA=(BASE SUPERIOR+BASE INFERIOR)*ALTURA/2*/
   return areatr;
}
float areaci (float r)                     /*AREA DE UN CIRCULO*/
{
   float areaci;
   areaci=3.14*r*r;                    /*AREA=PI*RADIO AL CUADRADO*/
   return areaci;
}
float perimci (float r)                 /*PERIMETRO DE UN CIRCULO*/
{
   float perimci;
   perimci=2*3.14*r;                     /*PERIMETRO=2*PI*RADIO*/
   return perimci;
}
long basexp (long bas, int exp)
{
   long bas2, res;                          /*POTENCIA*/
   bas2=bas;
   if (exp==0)
   {
   res=1;
   return res;
   }
   if (bas==0)
   {
   res=0;
   return res;
   }
   if (exp<0)
   {
   res=0;
   }
   exponente:
   bas=bas*bas2;
   exp--;
   res=bas;
   if (exp!=1) goto exponente;
   return res;
}
void code (char mode[])
{
   char decode [100];
   gets(decode);                        /*CODIGOS*/
   if (strcmp(mode,decode)==0) return;
   exit(0);
}
void end (int opc)
{
   switch (opc)                          /*FINALIZA EL PROGRAMA*/
   {
   case 1:
   clrscr();
   gotoxy(38,30);
   printf("ERROR");
   break;
   default:clrscr();
   }
   getch();
   exit(0);
}
int alea (int num)
{
   return (1+random(num));                  /*NUMEROS ALEATORIOS*/
}
void recover (int *recu, int mantn)
{
   static
   *recu=mantn;                          /*RECIBE Y DEVUELVE UN VALOR*/
}
float IVA (float num)
{
   return ((num/100)*21)
}

#endif  /* __UTILIDAD_H */
ups, cometi un error... no copien la funcion recover porque no la copie del archivo correcto. :-)
(leandroleu 2009-11-30 13:00:11)

Para enviar comentarios debes estar registrado.

(c) ElRincondelC.com

Un proyecto de Urlan Heat : proyectos de Internet y soporte para el comercio electrónico.