gpt4 book ai didi

c++ - 弗莱施程序 C++

转载 作者:行者123 更新时间:2023-11-30 02:55:26 24 4
gpt4 key购买 nike

<分区>

我正在尝试编写一个程序,通过计算程序中的单词、句子和音节来计算文本文件 (Flesch) 的分数,现在我遇到了在 bool 函数之后声明 bool 函数的问题为每一个写代码。这是我得到的:

#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;
}

有什么想法吗?我在遇到问题的行旁边添加了注释。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com