76 245
Assignments Done
Successfully Done
In May 2019

Answer to Question #39505 in C++ for Verasak Sitawan

Question #39505
Write C++ function named customerCreditLimit()that accepts a double as a parameter
and displays the value as the amount of credit granted to a customer. Provide a default
value for the function so that if a program calls the function without using an argument,
the credit limit displays $500. Write a main()function that proves the function works
correctly, whether it is called with an argument or without.
Expert's answer
#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

void customerCreditLimit( double val=500) /*default parameter*/
int main () /* main function*/
char s[128];
printf ("enter amount of credit or 'e' for default: ");
if ( strcmp(s,"e") == 0 )
customerCreditLimit(); /*print default value*/
customerCreditLimit(atof(s)); /*print user value*/
system ("pause");
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions