A.. Write a code to define a structure named student, which includes name, student number and email address
B. Write a code to define a linked list node using the above defined structure student (i.e. the data of the node is a student structure).
C. Write a recursive function names factorial to compute the factorial of the parameter. Also write the main function, where you ask the user to input a non-negative integer number. Then call the function factorialand display the result.
Expert Answer
A. Structures Student :
typedef struct student{
string name, email;
int studentNumber;
} student;
B. LinkedList node
typedef struct Node{
student s;
Node *next;
} Node;
C. C++ program :
#include <iostream>
using namespace std;
int factorial(int x){
if(x==1){
return 1;
}
return x*factorial(x-1);
}
int main()
{
printf(“Fact is %dn”,factorial(5));
return 0;
}
OUTPUT :