Programowanie w systemie UNIX/FLINT: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
m →‎Typy: print
Linia 127:
GMP-6.1.1
Flint-2.5.2
 
==liczby całkowite==
 
<source lang=c>
/*
gcc c.c -lflint -lgmp -lmpfr -lpthread -Wall
export LD_LIBRARY_PATH=/usr/local/lib/
*/
#include <gmp.h>
#include <mpfr.h>
#include <flint/flint.h>
#include <flint/fmpz.h>
 
 
int main ( void )
{
 
fmpz_t x , y ;
// init
fmpz_init ( x ) ;
fmpz_init ( y ) ;
// set
fmpz_set_ui (x , 7) ;
fmpz_mul (y , x , x ) ;
 
 
// print
fmpz_print ( x ) ;
flint_printf ( " ^2 = " ) ;
fmpz_print ( y ) ;
flint_printf ( " \n" ) ;
flint_printf (" MPFR-%s \n GMP-%s \n Flint-%s\n", mpfr_version, gmp_version, FLINT_VERSION );
// clear
fmpz_clear ( x ) ;
fmpz_clear ( y ) ;
return 0;
}
</source>
 
Wynik :
 
<source lang=bash>
gcc c.c -lflint -lgmp -lmpfr -lpthread -Wall
./a.out
7 ^2 = 49
MPFR-3.1.5
GMP-6.1.1
Flint-2.5.2
 
</source>
 
==primegen==