#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Define interdependent 'cells' using the Overwrite command.
   uc.Define("Overwrite ~~ Function: A1() = 10");
   uc.Define("Overwrite ~~ Function: B1() = A1() * 2");
   uc.Define("Overwrite ~~ Function: C1() = A1() + B1()");

   cout << "Initial C1: " << uc.Eval("C1()") << endl; // Should be 10 + (10 * 2) = 30

   // Now, overwrite the source cell A1. All dependent cells should automatically update.
   uc.Define("Overwrite ~~ Function: A1() = 50");

   cout << "Updated B1: " << uc.Eval("B1()") << endl; // Should now be 50 * 2 = 100
   cout << "Updated C1: " << uc.Eval("C1()") << endl; // Should now be 50 + 100 = 150
}