我目前正在學習C++,並且面臨着難以使我的函數的參數正確。作業:用於C++函數的參數
的問題,我的截圖:
到目前爲止我的代碼是:
int countInRange(Vector<int> array, int min, int max){
/*
Actual code goes here......
*/
return 0;
}
現在的編譯器不接受Vector<int> array
,並引發了我這個錯誤:
no match for 'operator=' (operand types are 'Vector<int>' and '<brace-enclosed initializer list>') param0 = {28, 1, 17, 4, 41, 9, 59, 8, 31, 30, 25};
我知道這個問題是使用斯坦福標準庫,但我不認爲這是主要問題。
我將不勝感激修復Vector<int> array
部分的任何幫助。謝謝!
感謝您的幫助!據我所知,標準庫「的std ::載體」可能是從斯坦福大學的圖書館「載體」不同的資本「V」:
http://stanford.edu/~stepp/cppdoc/Vector-class.html
我會盡量提供更多的信息對大家有幫助。
如果來自'std',Vector'應該是'vector'(所有小寫字母) –
您能顯示param0的聲明嗎?我猜這是一個矢量,因此你試圖分配的任務是無效的。 –
audio
歡迎來到堆棧溢出。請發佈[MCVE](http://stackoverflow.com/help/mcve)。 –