Código: Seleccionar todo
Function Main()
local nYear := 1900
local lResult
local nCubo := 0
local cNum
local getlist := {}
cls
@ 10, 10 SAY "Introduzca un año para saber si es bisiesto:" GET nYear PICTURE "@K 9999"
@ 11, 10 SAY "Introdice un numero para calcular el cobo..:" GET nCubo PICTURE "@K 9999"
READ
lResult := HB_INLINE( nYear ) {
HB_UINT uiYear = hb_parni( 1 ); // Recupera un entero pasado a la función desde PRG en la pila de harbour
HB_BOOL lRet = HB_FALSE;
if( uiYear > 0 ) // Si el año es mayo de 0 calculamos
{
lRet = ( ( uiYear % 4 == 0 && uiYear % 100 != 0 ) || ( uiYear % 400 == 0 ) );
}
hb_retl( lRet ); // Devuelve un valor logico por medio de la pila de harbour
}
if lResult
Alert( "El año es bisiesto" )
else
Alert( "El año no es bisiesto" )
endif
cNum := hb_ntos( nCubo ) // El numero como cadena
HB_INLINE( @nCubo ) { // No devuelve nada sino que usa la misma variable para depositar el cubo
HB_MAXINT iCubo = hb_parnint( 1 );
iCubo = iCubo * iCubo * iCubo;
hb_stornint( iCubo, 1 );
}
Alert( "El cubo de " + cNum + " es " + hb_ntos( nCubo ) )
cNum := 777
HB_INLINE( @cNum ) {
#include "hbapi.h"
long iNum = HB_LONG( hb_parni( 1 ) ) ;
hb_stornl( iNum, 1 );
}
Alert( hb_ntos( cNum ) )
return nil
Saludos