void searchFlight(cust flights[] ,int row)
{
clrscr();
cout << "Search for the flight you are looking for.\n";
string airport;
cout << "Enter Departing Flight : ";
cin >> airport; //error
for (int r=0;r<row;r++)
{
if (strnicmp(airport, flights[r].airport[20], strlen(airport) ==0) //error
{
clrscr();
cout << flights[r].name[20] <<endl;
cout << flights[r].airport[20] <<endl;
cout << flights[r].destination[20] <<endl;
cout << flights[r].ticket <<endl;
cout << flights[r].passangers <<endl;
cout << flights[r].opCost <<endl;
cout << flights[r].income <<endl;
cout << flights[r].netProfit <<endl;;
pressKey();
}
}
pressKey();
}
对于 cin 错误:错误 C2678: binary '>>' : no operator found 采用'std::istream' 类型的左操作数(或没有可接受的转换)
对于 strnicmp 错误:错误 C2664: 'strlen' : cannot convert parameter 1 from 'std::string' to 'const char *'
我已经寻找解决此问题的方法,但无法解决。抱歉,如果这里有类似的帖子可以解决我的问题。