Flesch Program...

I need help figuring out why there's a error before a bracket for a program I'm writing for a class. I put an annotation where the error is

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
  #include <iostream>
#include <fstream>
#include <cctype>
using namespace std;

int numSentences, numWords, numSyllables; 
bool inSentence, inWord, inSyllable;
{ //expected unqualified-id before '{' token
if (inSyllable(char isSyllableStarting)){ 
	(numSyllables = 'a','e','i','o','u');
			return true;
	}
else (char isSyllableEnding){
			return false;
  }
	

if (inWord(char isWordStarting)){
		 (numWords = isalpha(numWords));
			return true;
}
else (inWord(char isWordEnding)){
return false;
	}/////
	
if (inSentence(char isSentenceStarting)){
	(numSentences = '.',';',':','!','?');
		   return true;
}
else (inSentence(char isSentenceEnding)){
		return false;
	}////
}
int main (int argc, char*argv[]) {
	   char c;
	   ifstream infile;
	   infile.open(argv[1]);
	   while (not (infile.eof())){ //start of loop
			  infile.get(c);
			  cout.put(c);
			 
		   for(int numSentences=0; numSentences < argc; numSentences++){  //Sentences
			  cout << numSentences << ": " << argv[numSentences] << endl;
			  }
			  
		   for(int numWords=0; numWords < argc; numWords++){//Words
			  cout << numWords << ": " << argv[numWords] << endl;
			  }
			  
		   for(int numSyllables=0; numSyllables < argc; numSyllables++){//Syllalbles
			  cout << numSyllables << ": " << argv[numSyllables] << endl;
			  }
			  }
			  infile.close(); //close file
			  return 0;
			  }
			   
  
	
	       	   
You are trying to declare a function, but all you have in front of it is a declaration of a few booleans.

1
2
3
4
bool func_name()
{
// Your code.
}


Is how it should be.
Hmmm...I tried what you suggested but it didn't work. I already declared the variables inSyllable, inWord, and inSentences as boolean functions so I don't know what you exactly mean
Topic archived. No new replies allowed.