Author Topic: Programming Megathread  (Read 107246 times)

do you really write it like that, with no indentation? or is that a problem with the website? I can't tell what's what without looking at it for five minutes
and you don't have to define SUM after main. you can just define it at the top where you already have the prototype of it. you only have to bother with those if you have two functions that need to call each other, and even then it doesn't need to be above main. some people prefer non-main functions to be below main, but personally I like main to be at the bottom
How do I fix that?
uh... by calling it in main
just a shot in the dark, but it looks like what you're probably supposed to be doing is using SUM to find the average. so instead of
AVG=(NUM1+NUM2+NUM3+NUM4+NUM5)/5;
you'd use
AVG = SUM(NUM1, NUM2, NUM3, NUM4, NUM5) / 5;

also what's with all the caps? is your teacher telling you to do that?

imo it looks neater to use parenthases when dealing with multiple actions at once

for example:

Code: [Select]
public static float Foo (float bar) {
    return (bar / 255f);
}

looks much better to me than

Code: [Select]
public static float Foo (float bar) {
    return bar / 255f;
}

also, that comment looks like a huge hassle :<
I like sphinx's autodoc format for python
I work entirely in Visual Studio, and that's the format they specify for adding comments and describing parameters for Intellisense.

I work entirely in Visual Studio, and that's the format they specify for adding comments and describing parameters for Intellisense.
Yeah, this, you just type /// and VS automatically inserts a template for the comments, with the summary, params, and returns blocks

do you really write it like that, with no indentation? or is that a problem with the website? I can't tell what's what without looking at it for five minutes
What would I indent? The professor has provided zero lecture notes involving formatting.
also what's with all the caps? is your teacher telling you to do that?
My professor always uses caps when naming variables and functions in example program notes, so it became a habit for me.

My professor always uses caps when naming variables and functions in example program notes, so it became a habit for me.
Urgh. You should learn camelcase, it's the current accepted standard for formatting variable names. basicallyCamelCaseLooksLikeTh is. When you name a variable, the first 'word' is lowercase, while each additional word in the name has an uppercase first letter. You should also work on self-documenting code by naming your variables smartly so the code is easy to read and understand.

What would I indent? The professor has provided zero lecture notes involving formatting.
Everything in braces gets one tab indent
If you put braces in those braces, then those contents get two tabs

What would I indent? The professor has provided zero lecture notes involving formatting.
My professor always uses caps when naming variables and functions in example program notes, so it became a habit for me.
https://google.github.io/styleguide/cppguide.html


So basically she has been teaching us her own unorthodox methods. Fantastic.
Funny because she has a degree in computer engineering.

That touches way more stuff than he even knows what it means tho
well... yes. but I'm sure he will eventually learn about most of it. and in the meantime it isn't going to hurt anything for that document to have more information than he needs

Man, writing code in all caps is old as forget.

Man, writing code in all caps is old as forget.
Wait, people did that?
Thats loving stupid.

Man, writing code in all caps is old as forget.
Unless it's SQL
Idk, something about SQL just feels right to write in all caps
Except for table, column, other etc object names

Unless it's SQL
Idk, something about SQL just feels right to write in all caps
Except for table, column, other etc object names
SQL is so wordy it feels like you're shouting commands at the computer.