There is an error in this line
cin >> X >> Y;
This is the function it belongs into
void InputData(int *X,int *Y)
{
cout << "Enter 2 integer values: ";
cin >> X >> Y;
}
Below is the whole code
#include <iostream>
using namespace std;
void Message();
void InputData(int *X, int *Y);
void OutputData(int X, int Y, int Sum);
int ComputeSUM(int X, int Y);
int main()
{
int X1,X2,SUM;
Message();
InputData(&X1,&X2);
SUM=ComputeSUM(X1,X2);
OutputData(X1,X2,SUM);
return 0;
}
void Message()
{
cout << "This program computes and displays SUM of 2 integer values!" << endl <<endl;
}
void InputData(int *X,int *Y)
{
cout << "Enter 2 integer values: ";
cin >> X >> Y;
}
void OutputData(int X, int Y, int Sum)
{
cout << "The SUM of " << X << " and " << Y << " is " << Sum << endl;
}
int ComputeSUM(int X, int Y)
{
int Sum;
Sum=X+Y; //return(X+Y)
return(Sum);
}
------------------------------------------------------------ Below is the original code in C language
#include <stdio.h>
#include <conio.h>
void Message();
void InputData(int *X, int *Y);
void OutputData(int X, int Y, int Sum);
int ComputeSUM(int X, int Y);
int main()
{
int X1,X2,SUM;
clrscr();
Message();
InputData(&X1,&X2);
SUM=ComputeSUM(X1,X2);
OutputData(X1,X2,SUM);
getch();
return(0);
}
void Message()
{
printf("This program computes and displays SUM of 2 integer values!\n\n");
}
void InputData(int *X,int *Y)
{
printf("Enter 2 integer values; ");
scanf("%d%d",X,Y);
}
void OutputData(int X, int Y, int Sum)
{
printf("The SUM of %d and %d is %d\n",X,Y,Sum);
}
int ComputeSUM(int X, int Y)
{
int Sum;
Sum=X+Y; //return(X+Y)
return(Sum);
}