CS50 Readability Problem Set Week 2 - Readability Solution 2024. (Beginners Guide)

preview_player
Показать описание
Welcome to This is CS50 Week 2 Problem Set - Readability. This tutorial will cover how to complete CS50 Readability.
Рекомендации по теме
Комментарии
Автор

Super simple explanation, which means the most elegant! I used a state machine, I know it was overkill but wanted to see if I could make it work.

jonnysegway
Автор

thank you. it was very good explanation. I finally got it

anastasiiavernik
Автор

Thank you, you are explaining those sets very well!

ZHDI
Автор

Thank you, Professor, for this video

ahmedtamer_tiktok
Автор

Thanks again great video, this was my favorite so far because we got to do most of it ourselves.
Here's the questions I'm left with.
So if libraries are just collections of pre-programmed functions does that mean we can create our own?  Is there a limit to the size of the library? Like the math library for example. It has to be really accurate but how could it be more accurate than if I just wrote the same code out myself? Is there something special about way the library is coded versus just creating our own function in our code?

Also I'm curious is there a place where there's like a library of libraries I assume github holds a lot of super specialized libraries and some of them might be like trade secrets. But if I as a coder was looking for a specific library for a specific task where would I search for it?

peterschreiber
Автор

Is there a way to user a for loop to print the results for diferent grades? Thanks

ezequielfraga
Автор

Just a quick stupid doubt why use "text[i]" why not just text?
What I think is that this is to denote individual characters in arrays. May be wrong.

mradulgoley
Автор

This one was very difficult for me. The only problem I have is taking the given text and figuring out where to start.. I’m thinking I need to master week 1 in order to understand more of this?

Do you have any advice for this?

Kozeyplace
Автор

Hi but wasn't CS50s instruction to create our own functions (eg int count_letters(string text)) and count the no. of letters, words, and sentences through those functions instead of the main function?

would really appreciate it if you could explain how to do that as that's what im stuck on :)

amirhyderfeisal
Автор

After correcting some errors, I still got this one:
error: array subscript is not an integer
int index = round[0.0588 * L - 0.296 * S - 15.8];

And this is the formula that was given. 🤔

szidko
Автор

Got to admit it Syntax error in c is quite frustrating

JosephSmith-pdez
Автор

i have the same code as you but the check50 gives me errors

vaishnavishinde
Автор

Call me stupid, but im pretty sure I have the same code as you, but im still facing the error "Segmentation fault (core dumped). Any Support appreciated:

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

int main(void)
{
string text = get_string("Text: ");

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

for(int i = 0; 1 < strlen(text); i++)
{

if (isalpha(text[i]))
{
letters++;
}
else if (text[i] == ' ')
{
words++;
}

else if (text[i] == '.' || text[i] == '!' || text[i] == '?')
{
sentences++;
}
}
float L = (float) letters / (float) words * 100;
float S = (float) sentences / (float) words * 100;

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

if (index < 1)
{
printf("Before Grade 1\n");
}
else if (index > 16)
{
printf("Grade 16+\n");
}
else
{
printf("Grade %i\n", index);
}
}

flo
Автор

it keeps giving me a use of undeclared identifier 'i' 21:25 if(isalpha(text[i]))

QuentonamisMaximus