Board index » cppbuilder » Single error

Single error


2004-10-29 07:58:51 PM
cppbuilder1
Hello... Ive copy/pasted the following code into c++ builder, but it says
the last "result" is undefined symbol...
#include <iostream.h>
#include <conio.h>
#pragma hdrstop
int multiply(int, int);
void showResult(int);
int main(int argc, char **argv)
{
int x, y, result;
cout << endl << "Enter the first value: ";
cin>>x;
cout << "Enter the second value: ";
cin>>y;
result = multiply(x, y);
showResult(result);
cout << endl << endl << "Press any key to continue...";
getch();
return 0;
}
int multiply(int x, int y)
{
return x * y;
}
void showResult(int res)
{
cout << "The result is: " << result << endl;
}
 
 

Re:Single error

On Fri, 29 Oct 2004, Kalle Palle wrote:
Quote

Hello... Ive copy/pasted the following code into c++ builder, but it says
the last "result" is undefined symbol...
Copied & pasted from where? (just curious)
Quote
void showResult(int res)
^^^
{
cout << "The result is: " << result << endl;
^^^^^^
}
These should agree, no?
3ch