Polymetic  1.1
A c++ library for polynomial and matrix arithmetic, focused on applications in Kinematics.
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
gmp_integer_demo.cpp
Go to the documentation of this file.
1 // Copyright 2018 Dhruvesh Nikhilkumar Patel
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 #include <gmpxx.h>
16 #include <iostream>
17 
18 int main ()
19 {
20  mpz_class a=10, b=23;
21  //mpz_class b (23);
22  mpz_class mul = a*b;
23  mpz_class sum = a+b;
24  mpz_class sub = a-b;
25  mpz_class div =a/b;
26  mpz_class mod = b%a;
27  std::cout<< "(a,b) = ("<<a<<","<<b<<")"<<std::endl;
28  std::cout<< "(a*b) = "<< mul<<std::endl;
29  std::cout<< "(a+b) = "<< sum<<std::endl;
30  std::cout<< "(a-b) = "<< sub<<std::endl;
31  std::cout<< "(a/b) = "<< div<<std::endl;
32  std::cout<< "(b\%a) = "<< mod<<std::endl;
33  return 0;
34 
35 }
int main()