-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinlinefunction.cpp
More file actions
27 lines (23 loc) · 908 Bytes
/
inlinefunction.cpp
File metadata and controls
27 lines (23 loc) · 908 Bytes
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
#include<iostream>
using namespace std;
inline int product(int a, int b){
// Not recommended to use below lines with inline functions
// static int c=0; // This executes only once
// c = c + 1; // Next time this function is run, the value of c will be retained
return a*b;
}
float moneyReceived(int currentMoney, float factor=1.04){
return currentMoney * factor;
}
// int strlen(const char *p){
// }
int main(){
int a, b;
// cout<<"Enter the value of a and b"<<endl;
// cin>>a>>b;
// cout<<"The product of a and b is "<<product(a,b)<<endl;
int money = 100000;
cout<<"If you have "<<money<<" Rs in your bank account, you will recive "<<moneyReceived(money)<< "Rs after 1 year"<<endl;
cout<<"For VIP: If you have "<<money<<" Rs in your bank account, you will recive "<<moneyReceived(money, 1.1)<< " Rs after 1 year";
return 0;
}