
Errors in the code:
Line 1: It should be #include <iostream>
Line 6 : There should be a cout before <<
Line 11: There should not a ; after if statement and it should be == and not just =
Line 12: perfectScore variable is not defined in the if block scope
Line 15: There should not a ; after if statement
Line 20: if block should have a closing }
THE CORRECT CODE:
#include <iostream>
using namespace std;
int main()
{
cout <<"Enter your 3 test scores and i will";
cout <<" average them:";
int score1,score2,score3;
cin>>score1>>score2>>score3;
double average;
average = (score1+score2+score3) /3.0;
bool perfectScore=false;
if(average == 100)
perfectScore=true;
cout<< "Your average is " <<average <<endl;
if(perfectScore)
{
cout<<"Congratulations!\n";
cout<<"That's a perfect score.\n";
cout<<"You deserve a pat on the back!\n";
return 0;
}
}
Find errors in code and get 100% feedback!! Foblem (30 Points) This program This programaverages >...
1 // This program averages 3 test scores. 2 // It uses the variable perfectScore as a flag. 3 include <iostream> 4 using namespace std; 5 6 int main() 7 { 8 cout << "Enter your 3 test scores and I will "; 9 << "average them:"; 10 int score1, score2, score3, 11 cin >> score1 >> score2 >> score3; 12 double average; 13 average = (score1 + score2 + score3) / 3.0; 14 if (average = 100); 15 perfectScore...
#include <iostream> uisng namespace std; int main() { cout<<"Enter your three test scores and I will "; <<" average them: "; int score1, score2, score3, cin>>score1>>score2>>score3; double average; average = (score1 + score2 + score3) / 3.0; if (average = 100); perfectScore = true; // set the flag variable cout<<"Your average is "<<average <<endl; bool perfectScore; if (perfectScore); { cout<<"Congratulations!\n"; cout<<"That's a perfect score.\n"; ...
Debugging: The code below has six errors. The errors may be syntax errors or logic errors, and there may be more than one per line; examine the code carefully to find them. Indicate each of the errors you find by writing the line number and correction in the space provided below. This program is designed to take a constant number of scores (3 in this case) and store them into an array. Then the array is passed to a function...
Find the errors in following program. //This program uses a switch statement to assign a // letter grade (A, B, C, D, or F) to numeric test score. #include <iostream> uisng namespace std; int main() { int testScore; cout<<"Enter your test score and I will tell you\n"; cout<<"the letter grade you earned: "; cin>>testScore; switch (testScore) { case (testScore < 60) cout<<"Your grade is F.\n"; break; case (testScore <70) cout<<"Your grade is D.\n" break; case (testScore <80) cout<<"Your grade is...
Find the errors in following program. //This program uses a switch statement to assign a // letter grade (A, B, C, D, or F) to numeric test score. #include <iostream> uisng namespace std; int main() { int testScore; cout<<"Enter your test score and I will tell you\n"; cout<<"the letter grade you earned: "; cin>>testScore; switch (testScore) { case (testScore < 60) cout<<"Your grade is F.\n";...
package _solution;
/**
This program demonstrates how numeric types and operators behave in Java
Do Task #1 before adding Task#2 where indicated.
*/
public class NumericTypesOriginal {
public static void main (String [] args) {
//TASK #2 Create a Scanner object here
//identifier declarations
final int NUMBER = 2 ; // number of scores
int score1 = 100; // first test score
int score2 = 95; // second test score
final int BOILING_IN_F = 212; // boiling temperature
double fToC;...
I am receiving an "undefined reference to" build error in my code that i do not know how to fix. Here is my main code in C++ (the line of code that is in question is in bold): #include <iostream> #include<iomanip> #include<stdio.h> #include<stdlib.h> using namespace std; //Prototypes of functions void sortTestScores(int*testScores,int size); double averageTestScore(int*testScores,int size); void printTestScores(int*testScores, int size); int main() { //variable declaration int *testScores; int size; int score; double average; //Prompt to enter size of array cout<<"Enter size...
Today assignment , find the errors in this code and fixed them. Please I need help with find the errors and how ro fixed them. #include <iostream> #include <cstring> #include <iomanip> using namespace std; const int MAX_CHAR = 100; const int MIN_A = 90; const int MIN_B = 80; const int MIN_C = 70; double getAvg(); char determineGrade(double); void printMsg(char grade); int main() { double score; char grade; char msg[MAX_CHAR]; strcpy(msg, "Excellent!"); strcpy(msg, "Good job!"); strcpy(msg, "You've passed!"); strcpy(msg, "Need...
Posted this a few hours ago. Can anyone help with this? IN C++ Perform the following: Read 10 bowlers with 3 scores each into 1 string array and 1 numeric array(2 dimension double array) Sort the data by individual bowlers averages, Don't forget to sort their names also. Calculate the average across and store in your existing array. Calculate the average down and store in your existing array. Print out the contents of both arrays. This will print the averages...
ASSIGNMENT #3 ** using System; namespace GradeCalculatorNew { class MainClass { public static void Main (string[] args) { int test1,test2,test3; double average,average2; char letterGrade; Console.WriteLine("Enter test score1"); test1=Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter test score2"); test2=Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter test score3"); test3=Convert.ToInt32(Console.ReadLine()); average=(test1+test2+test3)/3.0; average=(int)(average+0.5); ...