#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
char numerator1, denominator1, numerator2, denominator2, answer;
int main (int argc, char *argv[]) {
//Start to read picture
string line;
ifstream myfile ("picture.txt");
if (myfile.is_open())
{
while (! myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
//Finish reading picture
//Output
cout << "Enter your first ratio: ";
cin >> numerator1;
cin >> denominator1;
cout << "Now your second ratio: ";
cin >> numerator2;
cin >> denominator2;
if(numerator2="x"){
answer = numerator1 * denominator2 / denominator1;
cout << answer;
}
}
I get the following error:
"Proportions.cpp:37:15: error: assigning to 'char' from incompatible type 'const char [2]'
if(numerator2="x"){
^~~~
1 error generated."