HI!
I have some lines of code that need your help.
When I run this program, I'd like to type in a string named "Resist" at line number 18, and print out a component string, it's R.Rvalue like at line number 23 and 24. for instance, if I type: R3{R 4.5}, expected result is string "4.5", but this program prints out nothing.
Can anyone please explane it and way to fix?
thanks for your help
Here is my code:
The problem with your code is that at line 17 you define a variable R with an empty RValue and some random value for i.
On line 23 you assign this empty string R.RValue to a string s and wonder why s is empty.
Why do do assign a value to Resist on line 18 when you override it at line 20 ?
Why is i an int when you want to read a double or float value ?
The best way is the solution JLBorges posted but probably to difficult to understand.
It seems this exercise is above your current skill level. I would suggest that you first study the basics of input, string and stringstream class and postpone this exercise.
The only quick and dirty solution would be sth. like this. If you can live with it....