代码:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
ifstream fin ("ride.in.txt");
ofstream fout ("ride.out.txt");
int ta, tb;unsigned int i;
ta = tb = 1;
string a, b;
fin >> a >> b;
for (i = 0; i < a.size(); i++)
ta = ta * (a[i] - 'A' + 1) % 47;
for (i = 0; i < b.size(); i++)
tb = tb * (b[i] - 'A' + 1) % 47;
if (ta == tb)
fout << "GO" << endl;
else
fout << "STAY" << endl;
return 0;
}
错误:
error C2679:
binary '<<' : no operator found which takes a right-hand operand of type “std::string”
答案 0 :(得分:17)
我认为问题是:
#include <string.h>
更改为:
#include <string>
答案 1 :(得分:5)
std::string
运算符在<string>
标头中定义。
标题<string.h>
用于C风格的字符串函数。