Question: C++ This code contains five errors before it will work as desired. Find those errors, document a description of the errors and their fix, and
C++
This code contains five errors before it will work as desired. Find those errors, document a description of the errors and their fix, and fix them.
#include "pch.h" #include
int add(int, int); double add(double, double);
int main() { int a, b, x; float c, d, y;
cout << "Enter two integers "; cin >> a >> b; x = add(a, c); cout << "Sum of integers: " << x << endl;
cout << "Enter two doubles "; cin >> c >> d; y = add(a, b); cout << "Sum of doubles: " << y << endl;
return 0; }
int add(int a, int b) { int sum; sum = a + b; }
double add(double a, double b) { double sum; sum = a + b; return sum }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
