Flesch Program c++ -
i'm trying write program calculates score of text file (flesch) counting words, sentences, , syllables in program , right i'm having trouble having bool functions declared after write code each one. here's got: 
#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? put annotations next lines i'm having problems with.
remove semi-colon on first error line :)
instead of function definition, semi colon makes attempted function call followed braces doesn't make sense - confusing compiler.
insyllable(char issyllablestarting);{ //this 1 here.
also note should have return type. looking constructor because function definition has none.
more errors: have more wrong here that. example, if space current code @ error location, mess:
insyllable(char issyllablestarting); { if (numsyllables = 'a','e', 'i', 'o', 'u'){ return true; } insyllable( char issyllableending); { else{ return false; }
so, here's list of problems:
- semi colon shouldn't there on top line before function brace open.
- your if followed recursive call function instead of else mistakenly further down.
- your braces don't add - function never ends code above.
Comments
Post a Comment