Help regarding gmp programme.

Alexey Beshenov al at beshenov.ru
Sun Mar 1 13:38:36 CET 2009


At Sun, 1 Mar 2009 16:07:13 +0530,
Krishna Prasad wrote:
> 
> Dear gmp users
>                             I am krishna Prasad from department of
> mathematics, Indian Institute of Technology Delhi, India .
> 
>                            I am new to this group and try to learn gmp
> function. and i write a simple programme as given in the manual of gmp, this
> will generate a error, these are my programme :

> #include<iostream>
> using namespace std;

There are no <iostream> and "namespace std" in C.

> int
> main(void)
> {
> mpz_t a,b,c;
> mpz_init(c);
> gmp_printf("enter the large no.");
> gmp_scanf("%Zd",a);
> gmp_scanf("%Zd",b);
> mpz_add(c,a,b);
> gmp_printf("Sum is %Zd",c);
> }

int main () should return int.

And you must initialize integers before passing them to gmp_scanf.

-- 
Yours sincerely,
Alexey Beshenov <al at beshenov.ru>


More information about the gmp-discuss mailing list