Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Expert Solution
arrow_forward
Step 1
Code
#include<iostream>
using namespace std;
int findCostToCover(int l,int b,int h,int cost)
{
// perimeter of cuboid is 4(l+b+h)
int perimeter=4*(l+b+h);
cout<<"Permiter of cuboid is: "<<perimeter<<endl;
// now cost for 1 cm/2 is given as cost hence total cost will be
return (perimeter*cost);
}
#include <iostream>
using namespace std;
int main()
{
// we can pass length , breadth and height and cost as perimeter
int x=findCostToCover(10,20,20,20);
cout<<"Cost of perimeter is: "<<x<<endl;
return 0;
}
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Similar questions
- f:AB. A = {0, 1, 2}, B F(0) = 1, f(1) = 2, f(2) = 2 1. Is f, as described above, a function? If it is not a function, explain why. 2.If f is a function.Answer the following: a.lsfinjective? If it is not injective, explain why. {0, 1, 2} %3D b.lsf surjective? If it is not surjective, explain why. c.lsf bijective? If it is not bijective, explain why. d.Does f have an inverse? If f has an inverse, what is the domain and codomain of f? Use the name of the sets. Iff does not have an inverse, explain why. For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). BIUS Paragraph Arial 10pt x? X, Te Ix 田田田网 ABC - へ Ť {;} O WORDS POWERED BY !!! 田arrow_forwardAdd 3 parameters to each function in the code below. ********************************************* Code starts here ************************************************** Module.py #Defination to sort the list def sort(listNum): sortedList = [] #While loop will run until the listNum don't get null while(len(listNum) != 0 ): #Set the min as first element in list min = listNum[0] #iterate over the list to compare every element with num for ele in listNum: #If element is less than min if ele < min: #Then set min as element min = ele #append the sorted element in list sortedList.append(min) #Remove the sorted element from the list listNum.remove(min) return sortedList #Function to find the sum of all elements in list def SumOfList(listNum): #Set the sum as zero sum =0 #Iterate over the list to get every element for ele in…arrow_forwardGiven the code: void e(int x, int y) { if(y<2) { cout << x << " "; return; } cout << x << " "; e(x+1, y-1); } 1. Trace the function when x and y are 4.arrow_forward
- Given the code below, in your solution cell: make the necessary changes to write the code as a function. You can choose how to name your function, but try make sure it reflects what it is supposed to do. Identify which variables from the given code should be arguments to the function instead The result should be the value returned by your function Document your function using comments Provide 3 test cases with expected outputs for the function created. # the given code # initializing the variablesnumlist = [10, 5, 14, 8, 74]result = [[],[]]# for each elem in numlist insert a value into resultfor num in numlist: if num%3==0: result[0].append(num) else: result[1].append(num)# the final result print(result) # your solution: # Your test cases (3 test cases)arrow_forwardReturn Something to Me! Write a function that returns the string "something" joined with a space " " and the given argument a. Examples giveMeSomething("is better than nothing") → "something is better than nothing" giveMeSomething ("Bob Jane") → "something Bob Jane" - → "something something" giveMeSomething("something")arrow_forwardOptions are : F A D X C,E Barrow_forward
- Given the following functions:void sum(int a, int b, int total) { total = a+b;}int main() { int x=1, y=2, s=0; sum(x,y,s); cout << s << "\n"; return 0;}1. Explain the problem with the sum function.2. Explain how to fix the problem without changing the main function.arrow_forwardPlans Resources More - Overview Question 3 Consider the following function: int func(int x){ if (x == 0) %3D return 2, else if (x == 1) return 3; else return (func(x - 1) + func(xF 2)); What is the output of func(4)? Your answer: O13arrow_forwardConsider the following function shoots : def shoots(x: int) -> int: if x <= 0: return 0 4 elif x == 1: return shoots(x + 2) 6 elif x == 2: return shoots(x - 1) 80 elif x == 2: 9. return -1 10 else: 11 return shoots(x - 2) 2 3arrow_forward
- Return Something to Me! Write a function that returns the string "something" joined with a space " " and the given argument a. Examples giveMeSomething("is better than nothing") → "something is better than nothing" giveMeSomething ("Bob Jane") → "something Bob Jane" - → "something something" giveMeSomething("something")arrow_forwardGiven a function with one vector parameter scores. How should the parameter be defined if scores may by very large and the function will modify the parameter? A) constant, and pass by value B) not constant and pass by value C) not constant and pass by reference D) constant and pass by referencearrow_forwardUnique answer onlyarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY