微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

可读性,当我插入单词、字母和句子时,为什么 Coleman-Liau 索引公式不起作用?

如何解决可读性,当我插入单词、字母和句子时,为什么 Coleman-Liau 索引公式不起作用?

我的代码有什么问题?这是不起作用的部分

float L = (letters / words) * 100; and float S = (sentences / words) * 100;

当我将字母、单词和句子插入公式时,它给出了错误的答案。

#include <stdio.h>
#include <string.h>
#include <cs50.h>
#include <ctype.h>
#include <math.h>

int main(void)
{
char ch[500];

int i;
int ii; 
int iii;

int LettersWspace = 0;
int letters = 0;
int words = 1;
int sentences = 0;
int index;



string text = get_string("Enter Text: ");

 for(i = 0; text[i] != '\0'; i++)
 {
LettersWspace++;
 }
for( i = 0; i < LettersWspace; i++)
 {
if (text[i] == 32)
    letters++;
  }
  letters = LettersWspace - letters;

  ii = 0;
{
  if (text[ii] == ' ')
{
    words++;
}
ii++;
}

while (ii <= text[ii]);
   

iii = 0;
do
    {
if (text[iii] == '?' || text[iii] == '!' || text[iii] == '.')
{
    sentences++;
}
iii++;
}

while (iii <= text[iii]);

float L = (letters / words) * 100;

float S = (sentences / words) * 100;

return (index = 0.0588 * L - 0.296 * S - 15.8);


printf("%i\n",(int) sentences);

return 0;

    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。