我有一個賦值,我們應該使用cstrings而不是字符串。問題在於五個cout語句中的三個中的操作數爲<。任何人都可以幫我弄清楚如何讓操作數錯誤消失嗎?該代碼發佈如下。錯誤位置以粗體列出!謝謝!cstring <<找不到操作符的類型爲'std :: string'的右手操作數
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
int main()
{
int strLength, wPointer;
string custNumber, year, workOrderNumber;
string workOrder = "91800w940770";
strLength = workOrder.length();
wPointer = workOrder.find('w', 0);
custNumber.assign(workOrder, 0, wPointer);
year.assign(workOrder, wPointer + 1, 2);
workOrderNumber.assign(workOrder, wPointer + 3, strLength);
cout << "The length is " << strLength << endl;
cout << "The location of the w is " << wPointer << endl;
std::cout << "The customer number is " **<<** custNumber << std::endl;
cout << "The year of the order is " **<<** year << endl;
cout << "The order number is " **<<** workOrderNumber << endl;
system("pause");
return 0;
}