Question: Add the missing code according to the comments //code for pi.h double pi = 3.141; //code for main.cpp #include #include //an header file having a

Add the missing code according to the comments

//code for "pi.h"

double pi = 3.141;

//code for "main.cpp"

#include

#include

//an header file having a double variable whose value is 3.14

#include "pi.h"

using namespace std;

extern double pi;

double PI = 3.14159;

void sub1(int r)

{

double circumference = 0;

/*

calculate the circumference by referencing an external pi

print the value of circumference

add your code below:

*/

}

void sub2(int r)

{

double circumference = 0;

/*

calculate the circumference by referencing the global variable PI

print the value of circumference

add your code below:

*/

}

int main()

{

sub1(2);

sub2(2);

system("PAUSE");

return EXIT_SUCCESS;

}

//two global variables

$day = "Monday";

$month = "January";

$major = "physics";

$department ="biology";

function sub1()

{

#add your code below to print major name and department name

}

function sub2()

{

$department ="chemistry";

# 1. add your code below to print the value of the local variable, department

# 2. add your code below to print the value of the global variable, department

# 3. add your code below to assign a new value, Math, and print the value of the

}

sub1();

sub2();

?>

#!/usr/bin/python

#a global variable can be directly referenced in a function

#adding "global" keyword to a global variable in a function, it

#can be assigned to a new value

major = "physics"

department ="biology"

def sub1():

#print department name and major name

def sub2():

#assign a new value, "chemistry", to the global variable major

#and print the new value

def sub3():

department ="Math"

#print the value of the local variable, department

#assign a new value, Statistics, and print the value of the global variable, department

sub1()

sub2()

sub3()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!