FaSheezy Posted March 18, 2005 Report Share Posted March 18, 2005 I am taking Computer Programming this semester and I am so totally baffled by it. I go to the lectures and the recitations, I have a friend of mine who is a Computer Engineering major help me and I go to some office hours but I am just not grasping this code. There are so many things to keep up with, and AGH, I need some help! Does anyone here think they might be able to explain some of the concepts and how they work? If so, please email me at [email protected] I would sooo appreciate anything. Thanks Quote Link to comment Share on other sites More sharing options...
softwareNerd Posted March 18, 2005 Report Share Posted March 18, 2005 What background knowledge do you bring to the task? Programmed in some other language? If you have specific programming questions, the best place to ask about them would be the appropriate comp.* newsgroup. If you have very general and broad questions about programming, you probably need a good book and/or a good tutor. Quote Link to comment Share on other sites More sharing options...
Hugh Akston Posted March 18, 2005 Report Share Posted March 18, 2005 (edited) you may want to try http://www.truebasic.com/demo.asp the bronze demo. It's a compiler for the True Basic language. It will teach you the basic concepts of Let, Print, End, Run Input, line input Constants, Variables, string, numeric formulas, math operators For-Next, Do-While If-Then, If-Then-Else data read Arrays Subroutines, Functions and the rest. Then search google for exercises, believe me it should make a difference spending a couple of days. The demo gives you 15 minutes everytime you run it. So basically save your progress ever 15 mins and then open it again. If you like it ofcourse, then you may want to buy it. Edited March 18, 2005 by Hugh Akston Quote Link to comment Share on other sites More sharing options...
Hugh Akston Posted March 18, 2005 Report Share Posted March 18, 2005 wow this brings back memories http://sip.clarku.edu/tutorials/True_BASIC.html I think I'm going to whip out my true basic book. Quote Link to comment Share on other sites More sharing options...
iouswuoibev Posted March 18, 2005 Report Share Posted March 18, 2005 I am taking Computer Programming this semester and I am so totally baffled by it. I go to the lectures and the recitations, I have a friend of mine who is a Computer Engineering major help me and I go to some office hours but I am just not grasping this code. There are so many things to keep up with, and AGH, I need some help! Does anyone here think they might be able to explain some of the concepts and how they work? If so, please email me at [email protected] I would sooo appreciate anything. Thanks I learned a lot from browsing cplusplus.com. It marks out the differences between C++ and C so you don't have to worry about learning the wrong language. Are you adept at any higher level languages? Quote Link to comment Share on other sites More sharing options...
softwareNerd Posted March 18, 2005 Report Share Posted March 18, 2005 Does anyone here think they might be able to explain some of the concepts and how they work? Do you have some specific questions? This is the "misc" sub-forum, so why not make one consolidated post of your most pressing questions and see if folks here can help by answering or by pointing you to the appropriate source(s). Quote Link to comment Share on other sites More sharing options...
andrew Posted March 18, 2005 Report Share Posted March 18, 2005 I second softwareNerd's suggestion of posting your questions. There are several people on this forum, like softwareNerd, who can help you. I also suggest you check out some other forums like tek-tips.com. I'd like to warn you though, as a computer science and engineering undergrad I've been active in my fair share of programming forums and a lot of the guys aren't as friendly or helpful as the people on this forum. You'll get a lot of answers in the form of "RTFM," but don't let that discourage you. Quote Link to comment Share on other sites More sharing options...
Bryan Posted March 18, 2005 Report Share Posted March 18, 2005 I'm going to third softwareNerd's and Andrew's suggestions about posting specific questions. I'd be more than happy to help with any specific concept/program/problem in C. Quote Link to comment Share on other sites More sharing options...
iouswuoibev Posted March 18, 2005 Report Share Posted March 18, 2005 Another tip when studying programming is to read from as many sources as possible. Remember that passage in The Fountainhead where Wyndand stole a book and understood 1-quarter of it? You can do that when learning programming (preferably without stealing anything!). When reading about things you'll encounter a lot of concepts in the beginning that you don't understand; don't pay them any mind. As you read more and more you'll begin to fill in the gaps. The rate you learn will grow exponentially, and in the long run you'll learning a great deal in a very short amount of time, outpacing your academic studies. Persistence is the key. If you ask someone to explain something or look it up in a book, and you fail to understand it, that doesn't mean the information isn't valuable. Sometimes when you encounter a concept again explained in a different manner, it will suddenly become clear to you. Even reading a book that you barely understand at all can be valuable; your sub-conscious will absorb the information, and you'll end up with incomplete concepts floating around in the back of your head. Then when you keep pursuing different texts on the same subject, these concepts will fall into place and be understood with great rapidity. To put it another way, studying several different sources on the same subject works synergistically, as opposed to trying to force yourself to understand from one source. Of course, this method applies to studying almost any subject, not just programming. Quote Link to comment Share on other sites More sharing options...
Iakeo Posted March 18, 2005 Report Share Posted March 18, 2005 I am taking Computer Programming this semester and I am so totally baffled by it. I go to the lectures and the recitations, I have a friend of mine who is a Computer Engineering major help me and I go to some office hours but I am just not grasping this code. There are so many things to keep up with, and AGH, I need some help! Does anyone here think they might be able to explain some of the concepts and how they work? If so, please email me at [email protected] I would sooo appreciate anything. Thanks Apparently you have no "hooks" on which to anchor (hang?) this new information. The tricky bit is that perennial problem of "generalizing a plethora down into managable numbers", and being able to FIND (knowing why you're looking for what you need and where the answer to that "why" is translated to a "what") the specific "thing" you need to put in your code. (Sorry about the convolution of that last sentence. ) When each symbol (variable, operator, grouper [ "{}" ], built-in function, etc) is seen without the context of what the program is trying to "say", then it's inevitable that overload occurs, and bafflement takes over. So, what you need to do is learn how to READ the code as language. It's the non- linearity (or apparent non-linearity) of it that throws people. You have to discover what the "big blocks" do first. What does this program do as a whole? Then look into the next biggest blocks. What do they do, as individuals? Etcetera, on down the "chunking nesting hierarchy", until you understand what each part is there for. For each chunk, you should always know what it does as a whole while you are looking into how it does it. The context of all the internal parts of a chunk is "what this chunk DOES (is here for)". Then, when you want to create a program, the reverse process is called for. You decide what the whole thing is supposed to do, then what things need to be manipulated to accompish the overall task, which tells you how to divide the overall task into sub-tasks, then each of those tasks can be dealt with as individuals in how they manipulate and what they "trade" (to inject some objectivism in here) with their fellow sub-tasks. And it just continues like this until all the parts are manipulating their innards (doing their own creative work) and trading with their peers (passsing info via interfaces). The creating process is rather like creating a painting. First you sketch out "what it is" (large area demarkation), then you find out what particular "lines" need to pass from one area to another to make them "mesh" (perspective, inter-area continuities), then you find the areas within the bigger areas that have their own "character" and do the same thing you did with the bigger areas (sketch, continuity), until you've got "pretty much" what you want this thing to say, in bare bones (no color) fashion, then you add the "color" (the functionality is there, but it's not "pretty" until you add the color). Just my thoughts. And most importantly, "Know where your towel is at, and DON'T PANIC..!!" (( Thanks Doug Adams. )) -Iakeo Quote Link to comment Share on other sites More sharing options...
FaSheezy Posted March 18, 2005 Author Report Share Posted March 18, 2005 Wow, thanks for all the replies. Basically I'm sketchy on everything, but specifically I'm confused about style. I dont understand how everything gets spaced together correctly... I really don't know what to ask cause I don't know where to start. I'm supposed to create this calender program that's supposed to pull up a calender for any year between the max and min years. It prompts the user for a year and then provides it. I have NO CLUE how to do this.. She gave us sample code to get us started.. I think.. I'm looking at it but I dont know what it does. Apparently "program input is to be read from a text file.." I understand loops and all that stuff, I just dont know how to create a program. I really hate this. Quote Link to comment Share on other sites More sharing options...
Iakeo Posted March 18, 2005 Report Share Posted March 18, 2005 Wow, thanks for all the replies. Basically I'm sketchy on everything, but specifically I'm confused about style. I dont understand how everything gets spaced together correctly... I really don't know what to ask cause I don't know where to start. I'm supposed to create this calender program that's supposed to pull up a calender for any year between the max and min years. It prompts the user for a year and then provides it. I have NO CLUE how to do this.. She gave us sample code to get us started.. I think.. I'm looking at it but I dont know what it does. Apparently "program input is to be read from a text file.." I understand loops and all that stuff, I just dont know how to create a program. I really hate this. Well, other than saying that your "teacher" (and I use the term VERY loosely) is either quite inept in illustrating what "programming" is, or you're not being pesky enough in DEMANDING that someone show you how this stuff works. If you're not getting it, you need to GET IN SOMEONE'S FACE and demand that they do their freakin' job..!! In a nice way, of course, unless that's not working, then all bets are off. Don't be unethical, just don't give up. Creating some simpler programs that illustrate the principles and methods that will later be used in your calendar program would be a good start. The way teachers deal with people who are quite intelligent, but merely lack the "conceptual hooks" on which to hang what the teacher is trying to teach, is a major source of annoyance for me, personally. And tells me exactly how I should value the teacher in question. Some are worse than useless, but that's not telling you anything you don't already know. -Iakeo Quote Link to comment Share on other sites More sharing options...
dougclayton Posted March 18, 2005 Report Share Posted March 18, 2005 Wow, thanks for all the replies. Basically I'm sketchy on everything, but specifically I'm confused about style. I dont understand how everything gets spaced together correctly... I really don't know what to ask cause I don't know where to start. I'm supposed to create this calender program that's supposed to pull up a calender for any year between the max and min years. It prompts the user for a year and then provides it. I have NO CLUE how to do this.. She gave us sample code to get us started.. I think.. I'm looking at it but I dont know what it does. Apparently "program input is to be read from a text file.." I understand loops and all that stuff, I just dont know how to create a program. I really hate this. The way to tackle this problem is very similar to how you should tackle any problem: break it down into pieces. Since you're talking about C, which is a procedural language, you will end up making lots of little procedures that work together to solve the bigger problem. The trick is to learn how to "see" those little procedure when you're just given a big overall description ("make a calendar program"). Let's look at what your assignment is, and look for separable tasks. The first one that jumped out at me is this: "It prompts the user for a year and then provides it." Do you know how to write a program that just prompts a user for a year and then prints back what year the user gave? If so, that's one problem you don't need to solve. If you don't know how to do that, then forget all about calendar programs, because your homework problem just got a lot simpler: focus on that smaller task, and pretend that is all you have to do. (You'll come back to the complete assignment, when you get the smaller one working--and until you do get it working, you have no hope of completing the entire assignment, so just ignore it for now.) Suppose you still have no idea how to prompt the user for a number and prints it. Well, that task is composed of smaller tasks: prompting the user and writing a number to the screen. If you don't know how to do that, your task just got simpler: constrain your program to just printing out "2005" without getting it from the user. Ultimately, you will reach the simplest possible program, one example of which is the "hello world" program that just prints out "Hello world" to the screen. Google that for a C version, and start with that. You can then tweak it and modify it to do what you want, for instance to print out "2005" (the number, not the calendar) instead of "Hello world." Now, to anyone who's done any programming, these changes will seem like baby steps--and they are. Unfortunately, they might try to tell you to make some high-level flowchart, which I think is a big mistake at your level. Instead, you should be doing a process of "iterative refinement" (technically known as refactoring), starting from your base "Hello world" program, and adding capability as you figure out how to make the computer do it. This will entail a lot of "compile-run-debug" cycles, but believe me it is the fastest way to learn. To continue on up from prompting the user, let's look at the additional tasks you will face. First, you apparently have to validate the year given, so you will have to figure out how to check the number the user entered, and do something different if it doesn't meet the criteria (at this point, settle for printing "good number" if it is valid, or "bad number" if not). You may then want to tackle reading from a file instead of prompting the user (depending on how easy it is for you to get a number from the user vs. getting it from a file). In that case, modify your program to read in the number from a file whose name you have hard-coded into your program. At some point, you will be completely satisfied that you now have the proper year to use. Now you need to make a calendar for this year you have. Break down that process in the same manner (perhaps first with a loop that prints out 1 through 28/29/30/31 depending on the month, to verify you are determining the number of days properly). Do not worry about style at this point. You have no sense of style yet--that takes practice in the language first, and it doesn't sound like you have it yet. As you tweak and modify your program, be on the lookout for programming structures/approaches that work well, and those that are clunky. Learn to apply the patterns that work well, and learn to avoid the clunky ones. Once you have enough experience, you will be able to read style guides and start making your programs elegant and not merely functional. But this takes time. This process is very much bottom-up (do little tasks and build on them), rather than top-down (start with an overall plan for the entire program, and then write each piece). I have been programming for 14 years, and that's how I have always approached new programming problems that I was totally clueless about. This solves the Catch-22 you'd get otherwise: you can't make a high-level "architectural" plan until you have solved several examples of this type of problem, but you can't solve any of those problems without first making a plan and programming to it. Hope this was of some use to you, particularly in overcoming the "blank page" panic. If you'd like clarification of anything, let me know. Quote Link to comment Share on other sites More sharing options...
FaSheezy Posted March 18, 2005 Author Report Share Posted March 18, 2005 What you said makes so much sense. I know how to get a value from the user and then to show what was typed. I don't really see how to keep checking for bad data. I got points taken off that from my last program. I used an if-else statement, but it just seems like if I use that then I will have an infinity of if-else statements as long as the user keeps giving me bad data. (The teacher DID show us a flow chart.. which made sense, but helped me in no way whatsoever..) How do I make it read from a file.. and do I need to create the file that the program is going to be reading from? And if so, where is that file stored, and why isnt it just in the code itself? Quote Link to comment Share on other sites More sharing options...
plaintext Posted March 18, 2005 Report Share Posted March 18, 2005 (edited) I used an if-else statement, but it just seems like if I use that then I will have an infinity of if-else statements as long as the user keeps giving me bad data. Excellent! A repeated (and possibly "infinite") if-else is exactly what you need. To do that, you need a "loop". do { Â Edited March 18, 2005 by plaintext Quote Link to comment Share on other sites More sharing options...
FaSheezy Posted March 18, 2005 Author Report Share Posted March 18, 2005 Ok, I understand do-while loops.. sorta.. I have this so far do { printf("Please enter a year equal to or greater than 1582:"); scanf("%d", &year); if (year < 1582) printf("Invalid year, please try again:"); scanf("%d", &year); } while what goes in the while.. you said while there is still bad data.. so.. while (year < 1582); ? Quote Link to comment Share on other sites More sharing options...
HaloNoble6 Posted March 18, 2005 Report Share Posted March 18, 2005 Though very interesting (brings back memories of "hello world" for me), as I spend a lot of time coding myself, this thread has nothing to do with exchanging philosophical ideas. I suggest that the members participating in this thread take care of this through PM or email. Quote Link to comment Share on other sites More sharing options...
FaSheezy Posted March 18, 2005 Author Report Share Posted March 18, 2005 You're right.. sorry! Quote Link to comment Share on other sites More sharing options...
HaloNoble6 Posted March 19, 2005 Report Share Posted March 19, 2005 No, I'm sorry, FaSheezy, I was operating on wrong premises. See this post. Continue on with your programing. Quote Link to comment Share on other sites More sharing options...
Jason Fowler Posted March 19, 2005 Report Share Posted March 19, 2005 What you are doing seems odd as a starting point... this is like a first project or something correct? I'd be confused too. If you want I can send you source code of some very simple console programs that I made during an Intro to C course. The most difficult one is an arithmetic calculator that accepts integers and a character as an operator.(now that is a good project, fairly straightfoward) I can add comments to the code to help explain some things too. Quote Link to comment Share on other sites More sharing options...
softwareNerd Posted March 19, 2005 Report Share Posted March 19, 2005 (edited) No, I'm sorry, FaSheezy, I was operating on wrong premises. See this post. Continue on with your programing. Felipe, I admire you for listening to great advice . [Please don't delete this post as 'contentless'. ] Edited March 19, 2005 by softwareNerd Quote Link to comment Share on other sites More sharing options...
Cbaoth Posted March 19, 2005 Report Share Posted March 19, 2005 Ok, I understand do-while loops.. sorta.. I have this so far do { printf("Please enter a year equal to or greater than 1582:"); scanf("%d", &year);  if (year < 1582)  printf("Invalid year, please try again:");  scanf("%d", &year); } while what goes in the while.. you said while there is still bad data.. so.. while (year < 1582); ? Hmm my c is very sketchy (havent used it in 5 years or so). Basic logic for the above would be more like: do { printf("Please enter a year equal to or greater than 1582:"); scanf("%d", &year); if (year < 1582) { printf("Invalid year, please try again:"); } } while (year < 1582) Quote Link to comment Share on other sites More sharing options...
FaSheezy Posted March 19, 2005 Author Report Share Posted March 19, 2005 Anything anyone wants to send me to help me out would be very welcome. This isnt our first project, but our forth. I've been doing sort of alright.. in the sense that when I finish a project I feel incredibly confident about it but only getting a lot of points taken off for things that I dont understand, so I thought I might enlist the help of people who actually know what they are doing. My main problem is understand what loop would actually create the calendar itself. If someone could suggest a particular loop to use and then explain what exactly it does with the input to create the calendar.. oh wow, that would be fantastic. Thanks for help so far! Quote Link to comment Share on other sites More sharing options...
ramKatori Posted March 19, 2005 Report Share Posted March 19, 2005 ... My main problem is understand what loop would actually create the calendar itself. Won't do your homework. Will help with this hint about looping. (Using Code formatting, like poster above.) Print Year means:   LOOP  12 TIME     PRINT-A-MONTH     END-OF-LOOP[/code] Print Month means: [code]  LOOP  from 1 to ??     PRINT-WEEK-n     UNTIL no-more-weeks/days Quote Link to comment Share on other sites More sharing options...
FaSheezy Posted March 19, 2005 Author Report Share Posted March 19, 2005 I never asked you to do my homework, I asked for any help that you want to provide. So it's loops within loops.. wow, it's sad that I just understood that right now. I could never be a programmer. So if you have a variable that you declare at the beginning of the program, you could use it within nested-loops, right? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.