source code, C/C++ Programming

I hv an assignment to do, I almost done. But i cant find whats wrong- my code is to make a simple calculator using function''s all 4 patterns. I did like this-

#include
int add (int, int);
int sub (void);
void mul (int, int);
void div (void);
int main()
{
int add, sub, mul, x, y;
float div;
printf("Enter the 1st number: ");
scanf("%d", &x);
printf("Enter the 2nd number: ");
scanf("%d", &y);
add;
{
printf("the sum is %d",add(x,y));
}
sub;
{
printf("the substraction is %d", sub());
}
mul(x,y);
div();
return 0;
}
int add (int x, int y)
{
int add;
add=x+y;
return add;
}

int sub (void)
{
int sub, x, y;
sub= (x-y);
return sub;
}

void mul (int x, int y)
{
int mul;
mul=(x*y);
printf("the product result is%d",mul);
}

void div (void)
{
int x, y;
float div;
div=(x/y);
printf("the division result is %f",div);
}

Posted Date: 7/15/2012 10:54:08 AM | Location : United States







Related Discussions:- source code, Assignment Help, Ask Question on source code, Get Answer, Expert's Help, source code Discussions

Write discussion on source code
Your posts are moderated
Related Questions
Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Draw pie chart in c++ program: int main() {                 char cmd;                   cout                 cout                 cmd = toupper(getch());

I am having trouble declaring a variable and returning a value from my function.

A: It let you to provide an intuitive interface to users of your class, as well as makes it possible for templates to equally work well with classes and built-in/intrinsic types.

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of the c

flow chart for push operation in stack

A: #include // Test to see if pointer hopping is worthwhile. // strlen implemented with usual indexing mechanism. int strlen1( const char str[ ] ) { int i; for( i =

1. The management of a company would like to determine the median annual salary of its employees.Write a pascal program that display the number of employees and their median salary

Write a program to input two integers. If they are equal display "The numbers are equal". Otherwise display a message if the first is a multiple of the second or if it is not a mul

Project Description: Design and prepare software that can navigate a mobile robot using SLAM technique using vision sensor (camera). Skills required are C Programming, Engine