2 errors on this project

First error is
"no operator "*" matches these operands"

and the second errors is
"binary '*': no global operator found which takes type 'std::string' (or there is no acceptable conversion)"

Any ideas? The errors are on these codes:

DeLIGHTful = 1.49 * single;
DoubleDeLIGHT = 2.49 * doublee;
TripleDeLIGHT = 3.49 * triple;
total = DeLIGHTful + DoubleDeLIGHT + TripleDeLIGHT;

and here's the rest just in case.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
	double DeLIGHTful,
		DoubleDeLIGHT,
		TripleDeLIGHT,
		 total;

		string single;
		string doublee;
		string triple;

	cout << "Number of single scoop cones sold: ";
	cin >> single;

	cout << "Number of double scoop cones sold: ";
	cin >> doublee;

	cout << "Number of triple scoop cones sold: ";
	cin >> triple;

	DeLIGHTful = 1.49 * single;
	DoubleDeLIGHT = 2.49 * doublee;
	TripleDeLIGHT = 3.49 * triple;
	total = DeLIGHTful + DoubleDeLIGHT + TripleDeLIGHT;

	cout << "DeLIGHTful cones $" << setw(8) << setprecision(2) << fixed << DeLIGHTful << endl;
	cout << "Double DELIGHT cones $" << setw(8) << setprecision(2) << fixed << DoubleDeLIGHT << endl;
	cout << "Triple DeLIGHT cones $" << setw(8) << setprecision(2) << fixed << TripleDeLIGHT << endl;
	cout << "Total $" << setw(8) << setprecision(2) << fixed << total << endl;


	return 0;
}
closed account (48T7M4Gy)
you are trying to multiply numbers by strings.

eg line 26: DeLIGHTful = 1.49 * single;
DeLIGHTful is a double, single is a string

BTW your names are not the beat - you must get pretty tired typing them with all the case changes etc. They make it very easy to make a typo.
Ohhh I didn't catch that. How stupid of me haha
I just erased the strings and added those words on the double section. Everything works fine now. Thank you!!
Topic archived. No new replies allowed.