Home > Back-end >  C + + program running environment and running
C + + program running environment and running

Time:10-09

Find the sum of the squares of the three, requires int, float, and long data type of each three, using overloaded sumsqure function for three variables are the sum of the squares of the same type
This how to get from beginner's scream

CodePudding user response:

Int SumSqure (int a, b int, int) c
{
Return a * a + b + c * b * c.
}
A, float SumSqure (float float b, float c)
{
Return a * a + b + c * b * c.
}
A, long SumSqure (long long b, long c)
{
Return a * a + b + c * b * c.
}
With a simple template some
Template
T SumSqure (T, a, T, b, T, c)
{
Return a * a + b + c * b * c.
}

CodePudding user response:

reference 1st floor csucxy response:
int SumSqure (int a, b int, int) c
{
Return a * a + b + c * b * c.
}
A, float SumSqure (float float b, float c)
{
Return a * a + b + c * b * c.
}
A, long SumSqure (long long b, long c)
{
Return a * a + b + c * b * c.
}
With a simple template some
Template
T SumSqure (T, a, T, b, T, c)
{
Return a * a + b + c * b * c.
}
can you give me a simple about? Thanks a lot

CodePudding user response:

Function overloading and template, as long as it is should have books on c + +

CodePudding user response:

Estimation is the early stage of the course, and later will let them use the template

CodePudding user response:

Learned a template with the template, simple, not learning template is overloading, write three functions, only the function name is the same,
  • Related