- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
IT, Programming, & Web Development › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 2: [Arrays] – Functions, Variable and Scope, Debugging, Arrays, and Command Line Arguments › Pseudocode for readability lab problem and how to approach
Once the user enters string of text, I start with counting no. of sentences. Here is a pseudocode:
//To count no. of sentences in a string of text//
int noofsentences = 0;
Start from the beginning of file (or string of text);
If . or ! or ?
noofsentences = noofsentences + 1;
till EOF (end of text);
return noofsentences;
I know the above pseudocode is too elementary and might even not be without faults. Still seeking opinion if this is the way a programmer approaches. Is my approach to Readability lab needs any correctional advise.
Update:
[dm_code_snippet background=”yes” background-mobile=”no” slim=”yes” line-numbers=”yes” bg-color=”#abb8c3″ theme=”dark” language=”clike” wrapped=”yes” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]
#include <stdio.h> #include <cs50.h> #include <string.h> int main(void) { string enterword = get_string("input"); for int t = strlen(enterword); printf("%i\n", t);
[/dm_code_snippet]
Once the user enters string (enterword), do I need to create an array that will store all the characters (or string of text) entered by the user or array is already created when the user enters string input?
Reply
https://edstem.org/us/courses/176/discussion/970891?answer=2200298[learn_press_profile]