-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut15.cpp
36 lines (30 loc) · 795 Bytes
/
tut15.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Functions & Function Prototypes in C++
#include<iostream>
using namespace std;
// function prototyping
// type function-name (arguments);
// int sum(int a, int b); //----> Acceptable
// int sum(int a,b); //---->Not Acceptable
int sum(int , int ); //---->Acceptable
// void g(void); //---->Acceptable
void g(); // ----> Acceptable
int main(){
int num1,num2;
cout<<"Enter first number"<<endl;
cin>>num1;
cout<<"Enter second number"<<endl;
cin>>num2;
// num1 and num2 are actual parameters
cout<<"The sum is "<<sum(num1,num2);
g();
return 0;
}
int sum(int a , int b){
/* Formal parameters a and b will be taking values from actual
parameters num1 and num2 .*/
int c = a+b;
return c;
}
void g(){
cout<<"\nHello , Good Morning . ";
}