Skip to content

Instantly share code, notes, and snippets.

@GnsP
Created August 4, 2015 09:56
Show Gist options
  • Select an option

  • Save GnsP/1dbac77e70a7ef809400 to your computer and use it in GitHub Desktop.

Select an option

Save GnsP/1dbac77e70a7ef809400 to your computer and use it in GitHub Desktop.
test file for modular arithmatic suit
#include <iostream>
#include "modular.hpp"
using namespace std;
int main(){
modular<7> a,b,c,d;
a=3;
b=8;
c=-5;
cout<<a()<<" "<<b()<<" "<<c()<<endl; // expected 3 1 2
d = a+b;
cout<<d()<<endl; //expected 4
d=b-c;
cout<<d()<<endl; //expected 6
d=a*b;
cout<<d()<<endl; //expected 3
d=a.addInv();
cout<<d()<<endl; //expected 4
d=a.multInv();
cout<<d()<<endl; //expected 5
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment