Originally Posted by
SaptaZapta
Seems to me that before you can learn to write methods, you should learn to write C functions.
That's what I'd like to know, because the above concepts are so pointlessly unrelated as to seem to be confusing what he's trying to do.
It really sounds like the requirements as simple as:
Code:
void main()
{
int x, y, prod, s, diff;
string inputValue;
Console.WriteLine("Enter the first number: ");
inputValue = Console.ReadLine();
x = int.Parse(inputValue);
Console.WriteLine("Please enter the second number: ");
inputValue = Console.ReadLine();
y = int.Parse(inputValue);
prod = product( x, y);
s = sum( x,y);
diff = difference( x,y);
/*
Do whatever with values.
*/
return;
}
int sum( int x, int y )
{
return x+y;
}
int product( int x, int y )
{
return x*y;
}
int difference( int x, int y )
{
return x-y;
}
And then applying that logic to classes and methods. But generally you'd learn that bit first, not as a secondary concept.
Bookmarks