I'm using ginac (is not algebra compumputer) in ubuntu
I've installed ginac-tools and libginac-dev
I would like throw a syntax error using
a bad formula ( without a bracket for example) and I would like catch it in a block try catch in c++
What can I do?
This code doesn't work for me:
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main()
{
symbol x("x"), y("y");
ex poly;
for (int i=0; i<3; ++i)
try{
poly += factorial i+16)*pow(x,i)*pow(y,2-i);
}
catch(int e){
cout<< "Error" << e << '\n';
}
cout << poly << endl;
return 0;
}
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.