Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ok , so the following code is my homework. I did most of it but the teacher wants me to implement a small intentional bug
Ok , so the following code is my homework. I did most of it but the teacher wants me to implement a small intentional bug in it and I dont know how to do that. also she wants to know what is the program or the code about?
Also Debug at least one other program , what dose she mean ? dose she want a new coding program?
please help me and tell me what is the following code about and how can I implement a small intentional bug in it
// This program averages 3 test scores. The braces // were inadvertently left out of the if statement. #include#include using namespace std; int main() { int score1, score2, score3; // To hold three test scores double average; // TO hold the average score // Get the three test scores. cout << "Enter 3 test scores and I will average them: "; cin >> score1 >> score2 >> score3; // Calculate and display the average score. average = (score1 + score2 + score3) / 3.0; cout << fixed << showpoint << setprecision(1); cout << "Your average is " << average << endl; // ERROR! This if statement is missing its braces! if (average > 95) cout << "Congratulations! "; cout << "That's a high score. "; cout << "You deserve a pat on the back! "; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started