
The Big Programming Thread - Page 173
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
sluggaslamoo
Australia4494 Posts
![]() | ||
lannisport
878 Posts
On October 07 2012 10:33 nebffa wrote: Hi guys I am looking for excellent online C only guides (not C++). I have learned Python over the last few months and have done the first 85 project euler problems to learn along the way. I can't find any guides that are correct, that also have exercises for me to do. I was hoping "Learn C the Hard Way" would be good as I initially learnt Python from "Learn Python the Hard Way" but as it is in an alpha version some of its content is not fully correct. Plleeeease please please please suggest a good online guide if you know one I will love love love you. I'm actually on the reverse path as you. I was going to start C then move to Python but ended up going with Python first instead. I couldn't find any good online texts like I did with Python i.e. Dive into Python, Think like a Computer Scientist, Learn Python the Hard Way but there is a pretty good lecture series by UNSW. I recommend checking it out, plus it's in your language. https://wiki.cse.unsw.edu.au/info/COMP1917 | ||
NeMeSiS3
Canada2972 Posts
import java.util.Scanner; public class Alternating { public static void main(String args[]) { Scanner var = new Scanner(System.in); int num1, num2, num3, num4; System.out.println("Please enter first variable:"); num1 = var.nextInt(); System.out.println("Please enter second variable"); num2 = var.nextInt(); System.out.println("Please enter third variable"); num3 = var.nextInt(); System.out.println("Please enter fourth variable"); num4 = var.nextInt(); if(num1 < num2 && num2 > num3 && num3 < num4) System.out.println("Alternating"); else System.out.println("Not Alternating"); } } It works smoothly enough, now I have to do some other thing that I barely understand. These questions are worded so poorly T.T I might be posting again for more advice but before I do I just wanted to ask if this is ok? At first I was feeling like this would be "homework help" (which it is) but I'm not asking for you to do it, just guide me along a bit (as you can see I just kinda made my own program not following the advice hahahaha). Anywho thanks again. | ||
Deleted User 101379
4849 Posts
On October 08 2012 04:11 NeMeSiS3 wrote: Hey guys I wanted to thank you for helping me on my assignment, I didn't end up following really anything that was put but here's the program I got out. It works smoothly enough, now I have to do some other thing that I barely understand. These questions are worded so poorly T.T I might be posting again for more advice but before I do I just wanted to ask if this is ok? At first I was feeling like this would be "homework help" (which it is) but I'm not asking for you to do it, just guide me along a bit (as you can see I just kinda made my own program not following the advice hahahaha). Anywho thanks again. Your program only works for the case where num1 is the smaller number of the first 2, if the order is different but still alternating, it fails. Testcase: 9 1 8 2 | ||
NeMeSiS3
Canada2972 Posts
On October 08 2012 05:00 Morfildur wrote: Your program only works for the case where num1 is the smaller number of the first 2, if the order is different but still alternating, it fails. Testcase: 9 1 8 2 Ahh you're right so I have to make it so it accounts for the reverse thank you for noticing that. I just changed the line if(num1 < num2 && num2 > num3 && num3 < num4 || num1 > num2 && num2 < num3 && num3 > num4) This accounted for that error. Again thank you for picking that up, how silly of me. I was thinking about that when I started but it slipped my mind half way through. | ||
3FFA
United States3931 Posts
Also, my teacher has been looking for an online book of Programming in C (4.0, not 3.0). edit: And my teacher just recently realized the reason computers weren't printing was because of XCode. We also can't correctly perform scanf statements yet either so we are basically stalled every couple weeks on one subject until the next subject is fixed T.T To make matters worse, since the people that actually help with computers throughout the school are being overworked during the beginning of the school year and then under-worked towards the end there are only 2. | ||
lannisport
878 Posts
| ||
Blisse
Canada3710 Posts
On October 08 2012 10:18 lannisport wrote: Quick question. What sort of environment do you guys use when you program with Python on Windows or otherwise? I was thinking of getting Cygwin, is that recommended? You don't need any environments for Python unless you're going to be managing a huge library. Just write some text, save the file and double click it to run. In any case, I recently moved to Sublime Text 2 and it absolutely crushes all the other IDEs and text editors I've used. Notepad++ loads a bit faster, but Sublime Text 2 is a lot better feature wise, and it doesn't feel clunky like an IDE does. | ||
nebffa
Australia776 Posts
On October 08 2012 03:55 lannisport wrote:+ Show Spoiler + On October 07 2012 10:33 nebffa wrote: Hi guys I am looking for excellent online C only guides (not C++). I have learned Python over the last few months and have done the first 85 project euler problems to learn along the way. I can't find any guides that are correct, that also have exercises for me to do. I was hoping "Learn C the Hard Way" would be good as I initially learnt Python from "Learn Python the Hard Way" but as it is in an alpha version some of its content is not fully correct. Plleeeease please please please suggest a good online guide if you know one I will love love love you. I'm actually on the reverse path as you. I was going to start C then move to Python but ended up going with Python first instead. I couldn't find any good online texts like I did with Python i.e. Dive into Python, Think like a Computer Scientist, Learn Python the Hard Way but there is a pretty good lecture series by UNSW. I recommend checking it out, plus it's in your language. http://www.youtube.com/watch?v=hE7l6Adoiiw&feature=edu&list=PL6B940F08B9773B9F https://wiki.cse.unsw.edu.au/info/COMP1917 It seems like you actually went on the same path as me? Learning Python first? Am I misreading something? Aside from that... so so so so sick. Thankyou so much for posting this I can tell this is going to properly explain many things including pointers and malloc. I mentioned in my post that whoever posted something very useful I would love love love them. Did I mention I love love love you now? THANKS!!! | ||
Tobberoth
Sweden6375 Posts
On October 08 2012 15:42 Blisse wrote: You don't need any environments for Python unless you're going to be managing a huge library. Just write some text, save the file and double click it to run. In any case, I recently moved to Sublime Text 2 and it absolutely crushes all the other IDEs and text editors I've used. Notepad++ loads a bit faster, but Sublime Text 2 is a lot better feature wise, and it doesn't feel clunky like an IDE does. This, I started to use Sublime Text 2 recently as well and it's definitely the best text editor I've tried on windows. Obviously, it doesn't hold a candle to proper IDEs like Visual Studio, but I use it for absolutely everything which I don't handle in VS. As you said, notepad++ loads faster, but Sublime Text 2 looks way better and has some pretty sick functionality. The only real text editor I can compare it to is textmate on OS X, which is high praise indeed. | ||
3FFA
United States3931 Posts
On October 08 2012 05:45 3FFA wrote: Apparently XCode can't print at my school, yet other applications like Word can so I have to copy+paste code into a Word Document to print it at school. Is this at all normal? Also, my teacher has been looking for an online book of Programming in C (4.0, not 3.0). edit: And my teacher just recently realized the reason computers weren't printing was because of XCode. We also can't correctly perform scanf statements yet either so we are basically stalled every couple weeks on one subject until the next subject is fixed T.T To make matters worse, since the people that actually help with computers throughout the school are being overworked during the beginning of the school year and then under-worked towards the end there are only 2. My questions....they feel lonely... they have yet to find an answer. They are still... single.... forever alone.... =_[ | ||
Blisse
Canada3710 Posts
On October 09 2012 09:45 3FFA wrote: My questions....they feel lonely... they have yet to find an answer. They are still... single.... forever alone.... =_[ It's been one day yo. And anyone who doesn't use a Mac can't comment. And everyone who hasn't had printing issues with XCode can't comment. Judging by a Google on that, no one has had any but you. Also, if you are writing standard C programs, regardless of the text editor, scanf should work, otherwise your teacher is doing something wrong. Try to compile and run the C file via the Terminal please. You can write a C file in any text editor | ||
sluggaslamoo
Australia4494 Posts
On October 09 2012 09:45 3FFA wrote: My questions....they feel lonely... they have yet to find an answer. They are still... single.... forever alone.... =_[ Xcode is a piece of crap anyway. Just use textmate and iterm. If you have Xcode installed, you can just compile with gcc. If you are just doing trivial stuff, you can use TryC. (google TryC for Mac) | ||
3FFA
United States3931 Posts
On October 09 2012 10:00 Blisse wrote: It's been one day yo. And anyone who doesn't use a Mac can't comment. And everyone who hasn't had printing issues with XCode can't comment. Judging by a Google on that, no one has had any but you. Also, if you are writing standard C programs, regardless of the text editor, scanf should work, otherwise your teacher is doing something wrong. Try to compile and run the C file via the Terminal please. You can write a C file in any text editor Apparently the is we can't do certain things like scanf without an administrative user and pass and so they would have to make us admins, but if they do that, then trololol is totally going to occur. So, they have to figure out how to make us admins for just XCode but nothing else or find a workaround. Plus, since we have to do this with school we have to do it via rules and directions given by our teacher. One idea around the class is for it to be made for kids to be able to do all the actual programming at school so that if kids can't get their hands on things like XCode they don't have to worry. One of the reasons for these bugs is that this is a new class in the school, and they actually changed stuff about it during the Summer(Went from C++ to C). | ||
sluggaslamoo
Australia4494 Posts
On October 09 2012 11:36 3FFA wrote: Apparently the is we can't do certain things like scanf without an administrative user and pass and so they would have to make us admins, but if they do that, then trololol is totally going to occur. So, they have to figure out how to make us admins for just XCode but nothing else or find a workaround. Plus, since we have to do this with school we have to do it via rules and directions given by our teacher. One idea around the class is for it to be made for kids to be able to do all the actual programming at school so that if kids can't get their hands on things like XCode they don't have to worry. One of the reasons for these bugs is that this is a new class in the school, and they actually changed stuff about it during the Summer(Went from C++ to C). I'm surprised you can actually do that. Well you probably can't fix this, but draconian access privileges is usually due to incompetence, because they don't understand security properly, they just block rights to everything. You could just auto re-image the HDs every night and then allow the student to do whatever they want. So, they have to figure out how to make us admins for just XCode but nothing else or find a workaround. I really hope "they" isn't referring to the network admins. I can't believe someone would think of trying something like that, let alone try and figure it out. | ||
lolmlg
619 Posts
On October 09 2012 12:28 sluggaslamoo wrote: draconian access privileges is usually due to incompetence, because they don't understand security properly, they just block rights to everything That's the proper way to handle security. Incompetence would be trying to explicitly block individual things and allow the rest. | ||
3FFA
United States3931 Posts
| ||
sluggaslamoo
Australia4494 Posts
On October 10 2012 02:23 lolmlg wrote: That's the proper way to handle security. Incompetence would be trying to explicitly block individual things and allow the rest. So which is better? 1. Re-image the HD every night and allow a lot of freedom for the user. 2. Don't re-image, just block everything and make it impossible for the user to actually do anything. I've known good sys-ops and bad ones, the bad ones just block everything because they don't know what they are doing and don't want to get into trouble, the good ones actually figure out how to give users maximum flexibility while still maintaining security. Productivity generates value, not security. Generating value is always the top priority. | ||
3FFA
United States3931 Posts
| ||
sluggaslamoo
Australia4494 Posts
On October 10 2012 19:15 3FFA wrote: Thing is my school chooses #2 because they don't have enough staff. 2 People to cover at least 150-200 computers? (Estimated) You automate it, I dunno how they do it. | ||
| ||