Create a C function that will accept “Quantity of items”, “Price per quantity”, “Cash of the buyer” and display the “Change and Amount Rendered”. Display a message whether the transaction is successful or not.
#include <stdio.h>
#include <iostream>
using namespace std;
void func()
{
cout << "Quantity of items: ";
int n = 0;
cin >> n;
cout << "Price per quantity: ";
double p = 0.0;
cin >> p;
cout << "Cash of the buyer: ";
double c = 0.0;
cin >> c;
cout << endl << "Change and Amount Rendered." << endl << endl;
if (n*p <= c) cout << "Your transaction is successful.";
else cout << "Your transaction is not successful.";
}
int main()
{
func();
cin.get();
cin.get();
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!
Learn more about our help with Assignments:
C++