#include <stdio.h>
#include <cs50.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
string text;
int characters;
int letters = 0;
int count_letters();
int words;
int count_words();
int sentences = 0;
int count_sentences();
int main(void)
{
when I started to learn programming my teachers did it this way and I thought that was how it was done for some time until I decided to throw all of that out of the window and learn programming properly :(
I used to talk about it, but it has since been removed because there's little controversy these days: The modern best practice for statically typed languages is to not use Hungarian Notation.
However, in C++, scope-based prefixes are generally considered not harmful because they serve a different purpose: g_ and s_ typically have special usability concerns, and all of them help prevent naming hiding.
yes, the C++ string would be std::string and there are no typedefs or using namespace, so this is valid C although it probably is also valid C++ but would make no sense to use another string class
5
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Sep 05 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
4
u/_senpo_ Sep 06 '21
when I started to learn programming my teachers did it this way and I thought that was how it was done for some time until I decided to throw all of that out of the window and learn programming properly :(
5
u/GLIBG10B 🐧 Gentoo salesman🐧 Sep 05 '21
At least add some
g_prefixes, jeez1
u/UlyssesOddity Oct 16 '21
Eh, if you're writing a little itty-bitty one-page program, what's the harm?
1
u/jaygroblen Oct 23 '21
Algorithms professors be like
-1
u/nickpofig Sep 06 '21
This is c++, not c.
0
u/[deleted] Sep 09 '21
[deleted] — view deleted comment