N
nkomli
Okay, I want to allow the user to define their own variables and
equations and then use them to run a program. The user picks the
option to create a list of variables
If the user enters in r d and s at the prompt
how would you define each as a double variable?
Secondly I want to allow the user to enter in an equation that would
stored in a file than spit out when the program is running to
calculate the values. Let's say the user put
r+d+s
I was thinking of opening up a filestream and reading the user entered
equation into a file as a string
cin >> equation
fileout << equation
then reading it back into the string variable once the user chooses
the option to calculate values.
filein >> equation
and using the variables and the equation to calculate x.
x = equation
But I think it will give me errors since x just might spit out the
string. Can someone help me figure out a way to get this to work?
Thanks
equations and then use them to run a program. The user picks the
option to create a list of variables
If the user enters in r d and s at the prompt
how would you define each as a double variable?
Secondly I want to allow the user to enter in an equation that would
stored in a file than spit out when the program is running to
calculate the values. Let's say the user put
r+d+s
I was thinking of opening up a filestream and reading the user entered
equation into a file as a string
cin >> equation
fileout << equation
then reading it back into the string variable once the user chooses
the option to calculate values.
filein >> equation
and using the variables and the equation to calculate x.
x = equation
But I think it will give me errors since x just might spit out the
string. Can someone help me figure out a way to get this to work?
Thanks