Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

Discuss all branches of science

Answered: 1 week ago

Question

7. Where Do We Begin?

Answered: 1 week ago

Question

a. What is the purpose of the team?

Answered: 1 week ago