I have to code a program which takes as input a medicine's name and its quantity from the user. Then it must calculate the quantity with the given value. However, I am getting an error with the "*" (multiply operator). The error is given below.
Error: no operator "*" matches these operands
operator types are: std::string * int
Please help me solve this. I've also attached my code where you can also see the error clearly.
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
void main()
{
string med,quantity,panadol=0,piozer=0,burofen=0;
cout << "Pharmacy Management System" ;
cout << "\n Enter your Medicine Name : ";
getline(cin,med);
cout << "\n Enter your Medicine Quantity : ";
getline(cin,quantity);
int a,b;
if (med==panadol && med==burofen)
{
a= (quantity*2);
cout << a;
}
if (med==piozer)
{
b= (quantity*14);
cout << b;
}
getch();
}