when I enter The code below it says 2 errors and both are :
too many characters in constant
too many character in constant
#include <iostream>
using namespace std;
int main()
{
int b,q;
cout<<"Please enter the barcode"<<endl;
cin>>b;
if (b='access')
{
cout<<"Please enter the QTY"<<endl;
cin>>q;
cout<<600.00*q<<endl;
}
else if (b='pencil')
{
cout<<"Please enter the QTY"<<endl;
cin>>q;
cout<<1.00*q<<endl;
}
return 0;
}
You need to use a string for your barcode variable and strings need to be enclosed in "" type quotes not '' which are for single characters.
Also when you want to compare values in C++ use the double equals syntax a == b. When you say a = b you make a equal to b rather than testing their equality.