Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. A variable with ____________ scope is only visible whenthe program is executi

ID: 3618303 • Letter: 1

Question

1. A variable with ____________ scope is only visible whenthe program is executing in the block containing the variablesdefinition.
2. Convert the following if/else statement into a switchstatement: if (choice ==1) { cout << fixed << showpoint <<setprecision(2); } else if (choice == 2 || choice ==3) { cout << fixed << showpoint <<setprecision(4); } else id (choice == 4) { cout << fixed << showpoint <<setprecision(6); } else { cout << fixed << showpoint <<setprecision(8); }
3. Find as many errors as you can: I answered what I could but there are more.HELP!!!! // This program averages 3 test scores // it uses the variable perfect score as a flag
include <iostream> shouldnt this have a # in front ofit using namespace std;
int main() { cout << "Enter your 3 test scoresand I will " ; << "average them:";    nocout int score1,score2, score3, semicolon cin >> score1 >> score2>> score3; double average; average = (score1 + score2 + score3) /3.0; if (average = 100); ----; should it behere? perfectScore = true; // set the flagvariable cout << "Your average is "<< average << endl; bool perfectScore; if (prefectScore);----; should it be here? { cout <<"Congratulations! "; cout << "That's a perfectscore. "; cout<< " you deserve a pat on theback! "; return 0; ----------}missing }
            

2. Convert the following if/else statement into a switchstatement: if (choice ==1) { cout << fixed << showpoint <<setprecision(2); } else if (choice == 2 || choice ==3) { cout << fixed << showpoint <<setprecision(4); } else id (choice == 4) { cout << fixed << showpoint <<setprecision(6); } else { cout << fixed << showpoint <<setprecision(8); }
3. Find as many errors as you can: I answered what I could but there are more.HELP!!!! // This program averages 3 test scores // it uses the variable perfect score as a flag
include <iostream> shouldnt this have a # in front ofit using namespace std;
int main() { cout << "Enter your 3 test scoresand I will " ; << "average them:";    nocout int score1,score2, score3, semicolon cin >> score1 >> score2>> score3; double average; average = (score1 + score2 + score3) /3.0; if (average = 100); ----; should it behere? perfectScore = true; // set the flagvariable cout << "Your average is "<< average << endl; bool perfectScore; if (prefectScore);----; should it be here? { cout <<"Congratulations! "; cout << "That's a perfectscore. "; cout<< " you deserve a pat on theback! "; return 0; ----------}missing }
            

Explanation / Answer

x.Hnt style="background-color: yellow">Thanks for rating. ANSWER 1: