Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is meant by the keyword inline as applied to a function declaration? a) the

ID: 3805011 • Letter: W

Question

What is meant by the keyword inline as applied to a function declaration? a) the function definition will be substituted at every function call b) the function is optimized to be faster c) the function declaration requires no types for its parameters d) the function can only be called inline with the main program e) None of the above Write a c++ program that uses inline function circleArea to prompt the user for the radius of a circle and to calculate and print the area of that circle. Suppose a sequence of integers is defined by a_0 = 2; a_i+1 = 2a_1 - 3, i greaterthanorequalto 0. Write a recursive function to calculate the n-th term of this sequence. Write a recursive function to find the sum of the members of an integer array. What is the main advantage of using Templates. Write a program that uses two functions template called swap and power. Function template swap exchange the values of ANY two values and the second function template power returns the result of raising any number to an integer number. Test the program using integer and float pairs. Use reference parameter with the definition of function swap. Using the C programming language, write a function getString NoTabs() that has two parameters First parameter is a line of characters (i.e pointer to chararacter) and the second parameter is the length of the line of characters. This function returns the same line after all tabs were replaced with space. Write a class DateClass that will store a date and display it in the format "mm/dd/yyyy". The Class should provide the following constructors. DateClass()//Initialises to default date 20^th April 2004 DateClass(int year, int month, int year) void setdate () void printdate() if display the date in the format "mm/dd/yyyy" To test your program, include a main method and perform the following. Create date 20/Jan/2000, then display it.

Explanation / Answer

Q1. 1. What is meant by the keyword inline as applied to a function declaration?
a) The function definition will be substituted at every function call.
2. Write a C++ program that uses inline function circleArea to prompt the user for the
radius of a circle and to calculate and print the area of that circle.

#include <iostream>
#include <cmath>
using namespace std;
inline void circleArea()
{
    double radius;
    cout << "Enter the radius of circle: ";
    cin >> radius;
    double area = M_PI * radius * radius;
    cout << "Area: " << area << endl;
}
Q2. 1. Suppose a sequence of integers is defined by:
   a0 = 2;
   ai+1 = 2ai - 3, i >= 0
   Write a recursive function to calculate the n-th term of this sequence.
   int recursive(int i)
   {
      if(i == 0)
          return 2;
      return 2*recursive(i-1) - 3;  
   }
   2. Write a recursive function to find the sum of the members of an integer array.
   int sumOfElements(int array[], int size)
   {
      if(size == 0)
          return 0;
      return array[size-1] + sumOfElements(array, size-1);  
   }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote