1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

struct sample {
int x, y, z, a, b, c;
const sample square_root() const
{
sample t = { ( int ) std::sqrt( ( double ) x ),
( int ) std::sqrt( ( double ) y ),
( int ) std::sqrt( ( double ) z ),
( int ) std::sqrt( ( double ) a ),
( int ) std::sqrt( ( double ) b ),
( int ) std::sqrt( ( double ) c ) };
return ( t );
}
};
sample s1 = { 4, 9, 16, 25, 36, 49 };
sample s2 = s1.square_root();
std::cout << s2.x << ' ' << s2.y << ' ' << s2.z << ' '
<< s2.a << ' ' << s2.b << ' ' << s2.c << std::endl;
 