c++ - I can't understand why my output is 1,1 how can I change it to "type name" and "parameters"? TIA -
i'm new @ c++ , i'm reading functions i'm trying use string can't understand it. how can show "type name" , "parameters" in output? here's code:
#include <iostream> using namespace std; string f1 (string a) { string b; b = " type name "; return (b); } string f2 (string c) { string d; d = " parameters "; return (d); } int main () { string x,y; x = f1(" type name "); y = f2(" parameters "); cout<<"functions group of statements executed"<<endl; cout<<"when called. consist of"<< x <<","<< y <<endl; cout<<"and statement. can called some point of program."<<endl; return 0; }
cout<<"when called. consist of"<< f1 <<","<< f2 <<endl;
f1
, f2
functions. don't want output functions, want output result of calling functions.
x = f1(" type name "); y = f2(" parameters ");
you have stored result of calls in x
, y
, use those.
cout<<"when called. consist of"<< x <<","<< y <<endl; // ^ ^
Comments
Post a Comment