PDA

View Full Version : c++ program



justme
10-16-2007, 07:41 PM
hi there!
need help i need a simple c++ program with a function or subprogram on it... if meron kau.. plz pahingi copy ng codes.. kahit simple lang... i should be programming one kaso wala pa me compiler and im so busy eh... plz lang po...

Wowie
10-16-2007, 09:37 PM
I can help you with that, but what kind of program do you want?

justme
10-17-2007, 08:48 AM
kuya.. any c++ program that contains a function or a subprogram on it... pwde email nlng po at [email protected]

jalmz
10-17-2007, 08:54 AM
justme., daghan ko ana. but ako pang hilngon sa kaban..

btw try to use Google

type
"c++ + function subprogram"

justme
10-17-2007, 06:18 PM
justme., daghan ko ana. but ako pang hilngon sa kaban..

btw try to use Google

type
"c++ + function subprogram"
ok, kuya thnx... im trying to program na man... but if meron po kau... maybe it'l help... thnx talaga;)

Wowie
10-17-2007, 08:59 PM
Here you go, its a simple cpp program that adds two numbers using function.



#include<iostream.h>
#include<conio.h> //This header file is the library of clrscr() & getch()

int num1, num2, sum; // global declaration

void add (void); // function declaration

void main()
{
clrscr(); // clears the user screen
cout << "This is a sample program that adds to numbers" << endl;
add(); // A Function call
getch(); // Waits for a keyboard hit before exiting the program
}

void add(void)
{
cout << "\nEnter the 1st number: ";
cin >> num1;
cout << "\nEnter the 2nd number: ";
cin >> num2;

sum = num1 + num2; // adds the two numbers

cout << "\nThe sum of the two numbers is " <<sum << endl;
cout << "\nPress any key to exit...";
}

justme
10-18-2007, 04:14 PM
kuya, thnks...