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
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);
}
Comments
Leave a comment