Function call error

Hello everyone, I'm having trouble with one of my functions. I'm receiving error messages that say there is no function function to call, but the function exists and I've already checked for any typos. The other functions I've called to in main are typed the exact same way and are having no problems. I'm still new to c++ and programming in general, so any help/advice is appreciated. The error messages I'm receiving are:

new1.cpp: In function 'int main()':
new1.cpp:96:26: error: no matching function for call to 'Stringer::describe()'
stringerOne.describe();
^
new1.cpp:36:8: note: candidate: void Stringer::describe(bool)
void describe(bool longForm)
^~~~~~~~
new1.cpp:36:8: note: candidate expects 1 argument, 0 provided


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
#include <cctype>
#include <iostream>
#include "Creader.h"
using namespace std;

class Stringer 
{
	public: 
		string mString;
		
		void setString(string newString)
		{
			mString = newString;
		}
		
		void toUpperCase()
		{
			for (int i=0; i<mString.length(); i++)
			{
				mString[i] = toupper(mString[i]);
			}
		}
		
		bool contains(string lookFor)
		{
			if (mString.find(lookFor) == string::npos)
			{
				return false;
			}
			else
			{
				return true;
			}
		}
		
		void describe(bool longForm)
		{
			for (int i=0; i<mString.length(); i++)
				if (longForm == false)
					cout << mString << " (" << mString.length() << " characters)" << endl;
				else if (isalpha(mString[i]))
					cout << "ALPHA";
				else if (isdigit(mString[i]))
					cout << "DIGIT";
				else if (ispunct(mString[i]))
					cout << "PUNCT";
				else if (isspace(mString[i]))
					cout << "SPACE";
				else
					cout << "UNKNOWN";
		}
};

int main ()
{
	Creader reader;
	Stringer stringerOne;
	string tempString;
	int choice = 0;
	
	do {
		stringerOne.describe(false);
		
		cout << "[1] enter a new string\n";
		cout << "[2] convert the string to uppercase\n";
		cout << "[3] search for a word\n";
		cout << "[4] describe the string in long form\n";
		cout << "[0] quit the program\n";
		
		cout << "your selection: ";
		choice = reader.readInt(0, 4);
		
		switch (choice)
		{
			case 1:
				cout << "Enter a new string: ";
				tempString = reader.readString();
				stringerOne.setString(tempString);
			break;
			case 2:
				stringerOne.toUpperCase();
			break;
			case 3:
				cout << "Enter the word to search for: ";
				tempString = reader.readString();
				if (stringerOne.contains(tempString) == true)
				{
					cout << tempString << " found." << endl;
				}
				else
				{
					cout << tempString << " notfound." << endl;
				}
			break;
			case 4:
				stringerOne.describe();
			break;
		}
		
	} while (choice != 0);
	
	
	return 0;
}
> note: candidate: void Stringer::describe(bool)
> note: candidate expects 1 argument, 0 provided
the functiosn ask for a parameter, you need to provide a parameter
1
2
3
stringerOne.describe(true);
stringerOne.describe(false);
stringerOne.describe(answer == 42);



By the way, ¿why do you do compare a boolean against true/false? for example, your wrote if (stringerOne.contains(tempString) == true) instead of simply if (stringerOne.contains(tempString))
Thanks ne555, that solved my problem. As for comparing boolean against true against true/false, I thought I needed "== true" for it to function. I took your advice and shortened it to simply (stringerOne.contains(tempString)). I'm a novice to c++ and programming in general, so I'm still trying to get a handle on all this. I really appreciate your help. I wouldn't have been able to get my program to run without you.
Topic archived. No new replies allowed.