How do I modify a C++ class to display a warning for variables that are initialized but never used? My program accepts an expression and checks, among other things, that all variables are initialized. Currently, it throws an error when there is an unitialized variable, but how do I get it to display a warning for a variable that is not used and display that variables name in the output?
I enter: (2/3), x = 1;
It should display a warning along with the variable name and correct value:
Warning: Unreferenced Variable x Value = 0.666667
Right now it is only displaying: Value = 0.666667
I have included a few of the classes that I have created so far but can't figure out how to add this piece to warn when unreferenced variables are encountered. I have also include the UninitializedException.h file to show how I currently throw an exception for the uninitialized variables.