There are three ways to do repetitions in C as far as I know. The first is to use recursion (a function which calls itself) the second being a for loop and the third being a while loop, though both of these are basically the same thing. Here's a demonstration of using these three methods to compute the x raised to the power of y: (note this isn't the most efficient way of calculating the power of a number but it's good enough for an example)
//Recursion:
int pow(int base, int pwr){
if(pwr == 0){
return 1;
}else{
return base * pow(base, pwr - 1);
}
}
//For loop
int pow(int base, int pwr){
int i;
int result = 1;
//The for loop initialises i to the value of pwr, then
//runs the loop, subtracting 1 from i each time until
//i fails the test (i > 0) at which point the loop finishes
for(i = pwr; i > 0; i--){
result *= base
}
return result;
}
//While loop
int pow(int base, int pwr){
int result = 1;
while(pwr > 0){
result *= base;
pwr--;
}
return result;
}
...a function call.
There is no such thing. You probably meant the main function. The main function is the only function that is required as it serves as the entry point of the program.
The keyword is friend. The external function must be declared a friend of the class (from within the class itself) in order to become a member of the class and thus gain access to the private (and protected) members of the class.
C++ is easier to use as you have to learn slightly less and script slightly to make your function(s) work.
Every C plus plus program that is a main program must have the function 'main'.
cot(A+B+C) is, itself, a trigonometric function, so the question does not really make any sense!
yes,we can make function inline
Yep. No values of X will ever repeat themselves.
Dial [1] plus the area code, and the number itself
press function (Fn) + P
That is not a function, although it does involve the function of addition. A function is something that is done to numbers.
...a function call.
There is no such term as "building function" in C++.
The actual equation itself is the polynomial. There is no polynomial for it, and your question doesn't really make sense.
Control is returning to the caller of the function.
yes it can
It is the first function that gets called when the program is executed.