No matching function for call (3 arguments expected, 0 actual). Dealing with vectors and strings in C++ for the first time -


i trying write program gets bigger , smaller depending on data text file. there 3 functions have specific instructions. first project using vectors have been pretty confused. @ first getting lot of error messages have cut down 1 error in compiler.

the error getting in insert function there no matching function call , candidate expects 3 arguments there none. have googled error , have read might need constructor can't seem set correctly. see need edit code pass 3 arguments, i'm not sure if supposed in function below or in main.

another thought might passing wrong type googled error. possible haven't used vector , might not passing types correctly. calling reference might not right thing do.

if me out appreciate help. i've been fixing errors past few hours google can't seem fix final error(which admittedly because of several errors). thank you.

#include <iostream> #include <vector> #include <string> #include <fstream> using namespace std;  void insertfunction(vector<string>, string, int); void deletefunction(vector<string>, int); void printfunction(vector<string>); int main() {   vector<string> v;   string command, word;   int position;   ifstream fin;   fin.open("data_2.txt");   if(!fin){     cout << "the file doesn't exist " << endl;   }   else {     while (fin >> command){       if (command == "insert"){          fin >> word;          fin >> position;          insertfunction(v, word, position);        }         else if (command == "delete"){          fin >> position;          deletefunction(v, position);             }         else if (command == "print"){          printfunction(v);             }         else{          cout << "error! command not recognized" << endl;         }         }     }    return 0; }  void insertfunction(vector<string>& v, string position, int word){   v.insert(); } void deletefunction(vector<string>& v, int position){   v.erase(v.begin()+position); } void printfunction(vector<string>& v){   for(int = 0; < v.size(); i++){       cout << v[i] << " ";     } } 

v.insert(); 

the insert() method sociable method. wants talk parameters. likes parameters. parameters insert()'s best friends.

but because did not provide suitable set of parameters insert(), made method very, sad. lonely.

if make insert() method happy, please introduce nice, polite, friendly parameters. position insert something, , is.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -