-
Function of string ???
hi everyone, i just want to ask that can i make the following code into function?
Code:
if(physicalCycle(dob, currentDate) < 100 && physicalCycle(dob, currentDate) > 0)
{
cout<<"Ascending";
}
else if(physicalCycle(dob, currentDate) < 0)
{
cout<<"Descending";
}
else
{
cout<<"Critical day";
}
if yes, wat data type should i use? string?
-
Yes, you could. It could return a std::string, or void if you just plan to print from within the function.
-
can u give me an example of returning those as void..
-
Well I'm making a total guess as to what dob and currentDate are, but I guess thy're strings. You'd pass them in as const references though, and specify the return type as void.
Code:
void biorythmState(const string& dob, const string& currentDate) {
if(physicalCycle(dob, currentDate) < 100 && physicalCycle(dob, currentDate) > 0)
{
cout<<"Ascending";
}
else if(physicalCycle(dob, currentDate) < 0)
{
cout<<"Descending";
}
else
{
cout<<"Critical day";
}
}