function does not take 3 arguments

I'm trying to read text from "input.txt", but when I call the function ("check")i get the error: "function does not take 3 arguments".
please, help me.
here's "input.txt":
1
2
3
4
5
digraph G {
a[label="X"];
a->b;
a->c;
}


here's the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <fstream>
using namespace std;

class node {
private:
	vector<node*> mLinkedNode;
	string mID;
	string NodeName;
public:
	node() {NodeName="no name";}
	node(string id, string str) {
		mID=id;
		NodeName=str;
	}
	~node() {}
	void CreatEdge (node* newNode) {
		mLinkedNode.push_back(newNode);
	}
	void setID (string id) {
		mID=id;
	}
	void setNodeName (string str) {
		NodeName=str;
	}
	void prinfInfo () {
		cout<<"Infomation of node:"<<endl;
		cout<<"Name Node"<<NodeName<<endl;
		cout<<"ID:"<<mID<<endl;
		cout<<"Number of linked node:"<<this->mLinkedNode.size()<<endl;
	}
	int overlap (string str) {
		return (str==this->mID);
	}
};

string trim (string p);
int check (string str, vector<node> list_node);

int main()
{
	vector<node> list_node;
	string p;	
	fstream f;
	f.open("input.txt",ios::in);
	while(!f.eof())
	{
		getline(f,p);
		cout<<p<<endl;
		int i=0,x=0,y=0,z=0,t=0,u=0,v=0;
		while((i<p.length()) && (p[i]!='}')) {
			if(p[i]=='{') {
				x=i; ++i; 
				continue;
			}
			if(p[i]=='-') {
				y=i; ++i;
				continue;
			}
			if(p[i]=='[') {
				z=i;++i; 
				continue;
			}
			if(p[i]=='"') {
				if(t!=0) {
					u=i;++i;
					continue;
				}
				else {
					t=i;++i;
					continue;
				}
			}
			if(p[i]==';') {
				v=i;++i;
			}			
			if(v!=0) {
				if(z!=0) {
					string label=trim(p.substr(t+1,u-t-1));
					cout<<"label="<<label<<endl;
					string id=trim(p.substr(x+1,z-x-1));
					cout<<"id="<<id<<endl;
					check(id,label, &list_node); //here is wrong
				}
			}
			++i;
		}	
	}
	f.close();
	system ("pause");
	return EXIT_SUCCESS;
}


//delete whitespaces
string trim (string p)
{
	string whitespaces ("\t\f\v\n\r");
	p=p.erase(p.find_last_not_of(whitespaces)+1);
	p=p.erase(0,p.find_last_not_of(whitespaces));
	return p;
}

void check (string id, string label, vector<node> *list_node)
{
	if((*list_node).size()) {
		for(int i=0;i<(*list_node).size();i++) 
			if((*list_node).at(i).overlap(id)) {
				(*list_node).at(i).setNodeName(label);
				return;
			}
	}
	node newNode;
	newNode.setID(id);
	newNode.setNodeName(label);
	(*list_node).push_back(newNode);
}
Last edited on
On line 41 the function is declared with just two arguments.
int check (string str, vector<node> list_node);
Thanks a lot, Chervil. I solved my problem.
Last edited on
Topic archived. No new replies allowed.