I'm trying to write a program that calculates the score of a text file (Flesch) by counting the words, sentences, and syllables in a program and right now I'm having trouble having by bool functions be declared after a write code for each one. Here's what I got: </p>
#include <iostream>
#include <fstream>
#include <cctype>
using namespace std;
int numSentences, numWords, numSyllables; //for alphabet A-Z, a-z....unexpected unqualified0id before 'int'
int isalpha(char isWordStarting);
bool inSentence, inWord, inSyllable;//
inSyllable(char isSyllableStarting);{//error: expected constructor, destructor, or type conversion before ; token....
if (numSyllables = 'a','e','i','o','u'){//error: unqualified id before '{' token => inSyllable function
return true;}
inSyllable(char isSyllableEnding);{
else {
return false;
}
inWord(char isWordStarting);{
if(numWords = isalpha(char isWordStarting)){
return true;}
inWord(char isWordEnding);{
else {
return false;
}
inSentence(char isSentenceStarting);{
if(numSentences = '.',';',':','!','?'){
return true;
}
inSentence(char isSentenceEnding);{
else{
return false;
}
int main (int argc[1], char*argv[]) {
char c;
ifstream infile;
infile.open(agrv[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;
}
Any ideas? I put annotations next to the lines I'm having problems with.