C++ ( multiple question)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
C++ ( multiple question)

Transcribed Image Text:Consider only the following function call getLevel(95), which one is the last line of C++ code
that will be executed in the function getLevel when we call it with parameter 95?
cout << "A" << endl;
getLevel(95);
O return 0;
cout << "D" << endl;

Transcribed Image Text:Suppose we are using the program "level.cpp" below to judge students' level based on their
Score.
#include <iostream>
using namespace std;
void getLevel(int score) {
if (score >= 90) {
cout << "A" << endl;
} else if (score >= 75) {
cout << "B" << endl;
} else if (score >= 60) {
cout << "C" << endl;
} else {
cout << "D" << endl;
}
}
int main() {
getLevel(95);
getLevel(40);
getLevel(80 );
return 0;
}
Expert Solution

Step 1
In Case of if else statement :
1. If the first condition in if is given true then it will do whatever it is told in if condition and will get out of the loop and will not go ahead.
2. If the condition in the if statement is false only then it will go and check for the else cases and will execute the case of the correct one.
Step by step
Solved in 3 steps with 1 images

Recommended textbooks for you

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

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