Back To C++ User Defined Functions Index
//program to create a function that computes discount based on price entered by the user (price is passed to function as integer argument , if price is greater than or equal to 1000, discount is calculated as 10 percent else 5 percent ) #include
#include
void calcdiscount(int); void calcdiscount(int price) { float discount; if(price>=1000) { discount=0.1*price; } else { discount=0.05*price; } cout<<"discount is "<
>p; calcdiscount(p); getch(); }