Answer to Question #34321 in C++ for jay

Question #34321
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.
1
Expert's answer
2013-09-05T10:26:58-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS