Answer to Question #286375 in C++ for A lawal

Question #286375

Use pointer variables to write a program which reads quality and unit price of a product from the user, and the name of the user. The program should then calculate the total price of the product and print a personal price not on the screen

1
Expert's answer
2022-01-10T13:53:10-0500
using namespace std;




//	Use pointer variables to write a program which reads quality and unit price of a product from the user, 
//	and the name of the user. The program should then calculate the total 
//	price of the product and print a personal price not on the screen




int main()
{
	string Name,*N;
	float price,Qty,TotalPrice;
	float *P,*Q,*TP;
	
	N = &Name;
	P = &price;
	Q = &Qty;
	TP = &TotalPrice;
	
	cout<<"\n\tEnter User Name            : ";	cin>>Name;
	cout<<"\n\tEnter Unit Price of Product: "; cin>>price;
	cout<<"\n\tEnter Quantity of Product  : "; cin>>Qty;
	
	TotalPrice = *Q * *P;
	
	cout<<"\n\tTotal Price = "<<*TP;
	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