hey first time here. im a college student and im stuck in my computer science class on this program right now. i have to test if three values for the sides of a triangle can actually equal a triangle with this code:

Code:

double is_triangle();
double is_triangle()
{
double t1;
double t2;
double t3;
double total1;
double total2;
double total3;
cout<<"Side 1: ";
cin>>t1;
while(t1<=0)
{
cout<<"Side lengths must be positive. Try again."<<endl;
cout<<"Side 1: ";
cin>>t1;
cout<<endl;
}
cout<<"Side 2: ";
cin>>t2;
while(t2<=0)
{
cout<<"Side lengths must be positive. Try again."<<endl;
cout<<"Side 2: ";
cin>>t2;
cout<<endl;
}
cout<<"Side 3: ";
cin>>t3;
while(t3<=0)
{
cout<<"Side lengths must be positive. Try again."<<endl;
cout<<"Side 3: ";
cin>>t3;
cout<<endl;
}
total1=t1+t2;
total2=t2+t3;
total3=t1+t3;
if ((total1>t3)&&(total2>t1)&&(total3>t2))
{
cout<<"The values of the sides equal a triangle."<<endl;
cout<<endl;
}
else
{
cout<<"The values of the sides do not equal a triangle."<<endl;
cout<<endl;
}
return(0);
}

and im trying to find the area with another function using Heron's Method, which requires the three values for the sides. im not allowed to ask for the sides again so i need to use the t1, t2, and t3 values from the above function. how do i do that? here is my area code:

Code:

double tri_area();
double tri_area()
{
double s;
double area;
double t1;
double t2;
double t3;
s=(t1+t2+t3)/2;
area=sqrt(s*(s-t1)*(s-t2)*(s-t3));
cout<<"The area of the triangle is "<<area<<" units^2."<<endl;
cout<<endl;
return(area);
}

any input would really be appreciated