User Input and Derivatives with SymbolicC++

Time Write 1 Reputation point

Hello, I'm working on a project that requrires that I let the user input a nonlinear function to then have the derivative taken from it using C++. I am attempting to use SymbolicC++ but when taking in the user's input as a string, it takes the entire string as a constant. I tried using this for guidance but I don't think they realized it: (or maybe I'm missing something.)

#include <iostream>
#include <string>
#include "symbolicc++.h"
using namespace std;

int main(void)

    string inp;
    Symbolic x("x");
    cout << "Input: "; //input: 3*x*x
    getline(cin, inp);
    Symbolic input(inp);
    cout << "Derivative: " << df(input, x); //output: 0
    cout << endl;
    cout << "Integral: " << integrate(input, x); //output: 3*x*x*x
    return 0;

If anyone has any suggestions as to what I can do to symbolically take a user's input to find derivatives with SymbolicC++ or some other package in C++ that'd be much appreciated. Additionally this was the only other source of information I could find on the package:

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,600 questions
{count} votes