This is part of a calculator program, whenever I try to compile it I get the following error message:
no match for call to '(std::istream) (std::string&)'
Here is the code:
1 2 3 4 5 6 7 8 9 10
#include <iostream>
usingnamespace std;
int main()
{
string first_input;
cout << "Please press\nf for fractions\np for percentages\nn for simple sums\n";
cin (first_input);//this is the line where the compiler says the error is.
First of all you have to include <string> to use std::string
What you're doing on line 10 is not what you think. To read from cin you use cin >> variable
That looks like you're trying to call the istream constructor with a string as argument