Oct 13, 2015 at 2:42pm UTC
This is the error I am getting.
Severity Code Description Project File Line
Error (active) no operator "*" matches these operands Variables c:\Users\mumin\Documents\Visual Studio 2015\Projects\Variables\Source.cpp 12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <string>
#include <iostream>
using namespace std;
int main()
{
string str = "Hello World!" ;
cout << str << endl;
float dec = 5.0f * str << endl;
int integer = 65;
cout << "Integer = " << integer << endl;
}
I was trying to fix this original code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include #include
int mian ( )
{
string str = "Hello World!"
cout << str << endl;
cout << float x = 5.0f * str << end;
int 65Num = 65;
cout << "65Num = " < 65Num << endl;
}
Last edited on Oct 13, 2015 at 2:50pm UTC
Oct 13, 2015 at 2:48pm UTC
float dec = 5.0f * str << endl;
What's that mean? That's where your error is - you are multiplying a string by something.
Last edited on Oct 13, 2015 at 2:49pm UTC
Oct 13, 2015 at 2:59pm UTC
You may as well delete the line.
Oct 13, 2015 at 3:50pm UTC
What are you trying to achieve with that line? Why are you trying to multiply a string by a number?