All pastes #200038 Raw Edit

Untitled

public text v1 · immutable
#200038 ·published 2006-10-12 22:12 UTC
rendered paste body
/*
        Name: Sean Griffin
        Date: October 12, 2006
        Description:    Write code that will simulate the addition of numbers
                        using pointers.

                        This code will create two functions.  One function will
                        will request a number from the user.  The other function
                        will add numbers passed to it and return the result.

*/
#include <iostream>

int add(int *, int *);
void req_num(int *);

void main(void)
{
        int a, b;
        req_num(&a);
        req_num(&b);
        add(&a, &b);

        char c1;
        std::cin >> c1;
}

int add(int *a, int *b)
{
        return (*a+*b);
}

void req_num(int *num)
{
        std::cout << "Please insert your value: " << std::endl;
        std::cin >> *num;
}

/*
        Sample Output


*/