Answer:
Here is code in C++.
// include header
#include<bits/stdc++.h>
using namespace std;
// function to calculate the nth Fibonacci term
int nth_fib(int num)
{ // base case for the recursive function
if (num <= 1)
return num;
// calculate the Fibonacci term by adding last two term of the sequence
return nth_fib(num-1) + nth_fib(num-2);
}
int main ()
{
// variable to read term
int num;
cout<<"Please Enter the number: ";
cin>>num;
// calling the function to return the nth term of Fibonacci sequence
cout <<"The "<<num<<"th Fibonacci term is: "<<nth_fib(num);
return 0;
}
Explanation:
Declare a variable "num" to read the term. Call the function nth_fib() with parameter "num"; .In the nth_fib(),if num is less or equal to 1 then it will return(base case of recursive function).Otherwise it will calculate the Fibonacci term by adding the previous two terms. When it reaches to base condition, The function will return the nth term of sequence.
Output:
Please Enter the number:6
The 6th Fibonacci term is: 8
Title bar.
Menu Bar.
Toolbars.
Workspace.
Status Bar.
Scroll Bars.
Scroll Box.
Task Pane.
That’s all of the elements :)
Answer:
xcopy
Explanation:
xcopy (which stands for extended copy) command, was created to have several functions and ability to copy one or more folders, files or an entire directory from one location to another. It is more powerful than copy command that was seen in the first set of operating systems. It is currently being built into desktop operating systems and Microsoft windows server.
Answer:
1 void parseEmailAddress(string email, string& username, string& domain)
2 {
3 int found = email.find("@")
4 if (found > 0)
5 {
6 username = email.substr(0, found);
7 domain = email.substr(found+1, -1);
8 }
9 return;
10}
Explanation line by line:
- We define our function.
- We use an open curly bracket to tell the program that we are starting to write the function down.
- We apply the find method to the email variable that was passed by the main program. The find method tells us where is the "@" located within the email.
- We use an if statement to ensure that the value that we found is positive (The value is negative if an only if "@" is not in the email address).
- We use an open curly bracket to tell the program that we are starting to write inside the if statement.
- We apply the substr method to the email to take the username; it receives a start and an end value, this allows us to take from the beginning of the email (position 0) until the "@".
- We apply the substr method to the email to take the domain; it receives the position of the "@" character plus one to take the first letter after the "@" and a minus-one representing the last character on the email.
- We use a closing curly bracket to tell the program that the if statement has finished.
- We return nothing because we are using reference parameters, which means that the memory positions of username and domain are going to be filled by our parseEmailAddress function and the main function can access those values directly.
- We use a closing curly bracket to tell the program that the function has finished.