Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The code above is in C++. I had trouble figuring out where all the errors are, but any help would be greatly appreciated. Problem 2:
The code above is in C++. I had trouble figuring out where all the errors are, but any help would be greatly appreciated.
Problem 2: Finding Errors [20 points] Each of the 2 codes below contain at least 5 errors. Find them. Note: Marking correct code as an error will result in points deductions Example answer format: Code 1: Line 17: Missing semicolon Code 1 1. #include 2. #include 3. double ExpPower (int x, double y){ 4. return exp(x*y); 5. } 6. int square (double x){ 7. 8. } (x*x); 9. void main() { 10. double a, b; 11. a == 3; 12. b = 2; 13. std::cout < < "The product of a and b is " < < ExpPower (a, b) < < std::endl; 14. std::cout < < "The square of a is " < < square (a) < < std::endl; 15.} Code 2 1. #include 2. void Equal(int x, int y) 3. if (xy) 4. 5. 6. 7. } std::cout < < " The quadrilateral is a square "; else std::cout < < " The quadrilateral is a rectangle "; 8. int main{ 9. int side_a, side_b; 10. std::cout < < "Please enter 1st dimension of the quadrilateral "; 11. std::cin >> side_a; 12. std::cout>> "Please enter 2nd dimension of the quadrilateral "; 13. std::cin >> side_b;; 14. equal(side_a, side_b); 15.}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Code 1 1 Line 4 Missing semicolon after the return statement 2 Line 6 Missing return statement fo...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