// This tut includes Inline Functions, Default Arguments & Constant Arguments in C++.
#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
int c = a*b ;
return c;
}
float givemoney(int totalamount , float rate = 2.5){
int total= totalamount * rate;
return total;
}
int main(){
// int a,b;
// cout<<"Enter value of num1 :"<<endl;
// cin>>a;
// cout<<"Enter value of num2 :"<<endl;
// cin>>b;
// cout<<"The product of 2 numbers is :"<<product(a,b)<<endl;
// cout<<"The product of 2 numbers is :"<<product(a,b)<<endl;
// cout<<"The product of 2 numbers is :"<<product(a,b)<<endl;
// cout<<"The product of 2 numbers is :"<<product(a,b)<<endl;
// cout<<"The product of 2 numbers is :"<<product(a,b)<<endl;
int money=10000;
cout<<"Your total money is :"<<givemoney(money)<<endl;
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.