Good day guys, this is my first time posting, so if there is anything I should know about this particular forum, please do let me know! I have tried searching on the internet, but do you guys know what does this line do? istringstream is(Expr); if(Expr.at(i)=='(') p++; return Value_Of_Expr(Expr.substr(0,i))+Value_Of_Expr(Expr.substr(i+1,Expr.length()-i-1)); These three lines have something I don't understand, such as : istringstream is(XX) - What does it do? if(Exr.at(i)=='(') p++; return Value_Of_Expr(Expr.substr(0,i))+Value_Of_Expr(Expr.substr(i+1,Expr.length()-i-1));
When you post, there are posting guidelines, including how to post code. READ THEM PLEASE. They're not easy to miss. istringstream is(XX) creates an istringstream object named is, using a constructor that takes an XX as its argument, so it creates an istringstream from an XX. Code: if(Exr.at(i)=='(') p++; The brackets may be confusing you; let's add some space to clarify: Code: if( Exr.at(i) == '(' ) p++; So this calls Exr.at, passing in i, which returns a character, which the == compares with an open bracket. So this appears to be doing some kind of analysis of nested expressions where brackets are used for nesting.
Thank you for helping me out with that! I'm sorry I did not post a little chunk of code here because I thought if I could comprehend those few lines, I would be able to understand it. istringstream is(Expr); double value=0.0; is >> value; return value; thank you for helping me out with my little project here, I appreciate that!