Pascal program

Discussion in 'OT Technology' started by matt62182, May 10, 2008.

  1. matt62182

    matt62182 New Member

    Joined:
    Mar 25, 2007
    Messages:
    736
    Likes Received:
    0
    Location:
    MS
    we have to write a pascal program called groundhog day that will print the following

    year number extra weeks of winter
    1 1
    2 3
    3 5 (the numbers on the left are the year numbers and on the right are extra weeks of winter)
    4 7
    5 9
    6 11
    7 13
    8 15
    9 17
    10 19


    he gave us the 'hello world' example as a starting point but it doesn't really help.

    can someone please point me in the right direction:x:
     
  2. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,489
    Likes Received:
    70
    Location:
    Sparkopolis
    :hsugh: it took all of like 30 seconds to come up with this..

    Code:
    VAR i: Integer, j: Integer;
    
    FOR i := 1 TO 10 DO BEGIN
    	j := (i * 2) - 1;
    	WRITELN(i, ' ', j);
    END.
    
     
  3. Mike99TA

    Mike99TA I don't have anything clever to put here right now

    Joined:
    Oct 3, 2001
    Messages:
    4,553
    Likes Received:
    0
    Location:
    Greenville, SC
    Good lord they STILL teach pascal in school? They were phasing that out like 11 years ago when I was in high school.
     
  4. critter783

    critter783 OT Supporter

    Joined:
    Jul 15, 2005
    Messages:
    1,785
    Likes Received:
    0
    No one teaches a class about a language, because the language is not important. Classes are set up to teach the concepts of programming, and a language that can demonstrate the concepts in a simple manner is a good choice. You can teach the basics of structured programming in any language, so why not pick one that is relatively small and compact? Syntax is probably the least important thing you'll ever need to worry about.
     
  5. Mike99TA

    Mike99TA I don't have anything clever to put here right now

    Joined:
    Oct 3, 2001
    Messages:
    4,553
    Likes Received:
    0
    Location:
    Greenville, SC
    ... The structure and concepts are important yes, but learning a language that is actually useful in the real world is also helpful. Why have to have multiple classes to teach structure/concepts AND a language when you could combine them into one? C and C++ can both be used to teach structure while also helping someone learn a language that people still use to write useful programs.

    Anyway, what you just said is basically the exact same thing they told us when I was a Jr. in High school 11 years ago. Except they also said "We'll be moving to the C language next year because it can still be structured in a way that is conducive to teaching but it is more applicable to the real world". Also, all the colleges in the area used C/C++ for everything and none of them used Pascal, so former students were complaining about being thrown into classes that expected them to know some amount of a language they didn't know.

    Who knows if they actually changed. :dunno:
     
  6. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    0
    Location:
    OKC
    I complained to my professors about having to learn pascal as a first language. I made the claim that that class seemed more like a waste of time and could actually be more confusing to new students. Why? Because they have another round of syntax to keep straight in their head.

    I was surprised to hear that most of my professors would say, "Well it's an important language to learn if you're going to work in either academia or in pure comp sci." When I asked why it was "important" all they could really tell me is that it becomes more important the higher you go in school. I can say, when I was learning Oracle my pascal knowledge did help me because PL/SQL has some similarities. Other than that, I never used what I learned in my pascal class and I'm certainly not using it in my job.

    My problem is, everything about structured programming could have been taught in languages that were more relevant to my career. Since so many of us have been bitching, Java is an optional first language now. During my degree, my first exposure to Java was in my Object Oriented Programming class. So we had to learn the language AND the OOP principles all at the same time....that was ridiculous and many students struggled just to pass the class. This issue could have easily been solved by simply teaching us Java in our first class.

    I'm one that firmly believes that cultivating and building a students interest in programming is of paramount importance to keeping them engaged and making them want to continue along the path of computer science. I think this is accomplished more with Java or some other language that the students are likely to use during their careers. To me it seems like professors are just too rigid and stuck in their old ways....either that or too lazy to learn the newer languages.
     
  7. matt62182

    matt62182 New Member

    Joined:
    Mar 25, 2007
    Messages:
    736
    Likes Received:
    0
    Location:
    MS
    all science majors at my school have to take pascal....i honestly hate this class
     
  8. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,489
    Likes Received:
    70
    Location:
    Sparkopolis
    wait you're taking a whole class on Pascal and you couldn't do that program?
     
  9. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    It's important to teach the concepts in a language that has no practical use, because that way people don't marry the concepts to the language. Even if you learned the concepts using a popular language like Java or C++, you'd still have to take multiple classes and learn multiple languages in order to force your mind to separate the concepts from the languages.
     
  10. whup

    whup I wish you had children and.. so that I could step

    Joined:
    Feb 12, 2007
    Messages:
    1,603
    Likes Received:
    0
    I think another reason is that Pascal has similarities to Pseudocode (or rather the other way around heh)
     
  11. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    0
    Location:
    OKC
    IMO you're overstating the benefits and totally ignoring the potential downsides. The downsides include syntax confusion between languages, frustration on the students part due to perceived "uselessness" of the language and due to time constraints, the lack of depth in more useful languages.
     
  12. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,489
    Likes Received:
    70
    Location:
    Sparkopolis
    I had a course where we wrote code in Pascal, Fortran, Modula-2, Ada, COBOL, Perl, C, C++, Java, and more. The different syntaxes were not confusing. The first third of the class was learning about basically every programming language ever. History, domains, and how they were applied. The next 2/3 was about everything else, and we had to write code in those older languages all semester. We only had to compile the C programs, but we wrote code for all of them. It was great. If every programmer was as informed on as many languages as we were, the poorer languages would no longer be used. Of course, my instructor is the leading Programming Language Concepts professor in the country (almost every time that we tried to find homework answers online we would find references to him on other university's sites), so he's probably better at teaching it than many others, but it was one of the most useful courses I ever could have taken, and I'm glad we had to write code in the older languages.

    You guys are acting like the program in the first post was actually a difficult assignment.. it's 5 lines and took me like 2 minutes using google to look up syntax. It helped, of course, that I understand BNF and EBNF notations, but it was not difficult. The programs assigned for my PLC course would have been 2x longer than that.

    By the way, I graduated BS in CS yesterday :naughty:
     
  13. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,489
    Likes Received:
    70
    Location:
    Sparkopolis
    and syntax should not be considered a downside or an obstacle. programmers that get familiar with a language's syntax and never use anything else are likely never to learn anything else.. so Java continues to be used much longer than it should be.. and eventually they'll find themselves out of a job. and every language is useful.. even Java is useful for portability.
     
  14. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    0
    Location:
    OKC
    Great so since you didn't have any problems with the syntax, noone else should either. :ugh2:
    [/quote]
    The first third of the class was learning about basically every programming language ever. History, domains, and how they were applied. The next 2/3 was about everything else, and we had to write code in those older languages all semester. We only had to compile the C programs, but we wrote code for all of them. It was great. If every programmer was as informed on as many languages as we were, the poorer languages would no longer be used. [/quote]
    Disagree.

    First, one does not need to know about all the older programming languages in order to make a decision on which language to use. Most companies just pick the standard language and you go with this.

    Next, programming languages are not simply abandoned because newer languages are released. There needs to be a compelling business reason to rewrite the code and simply saying the language X is new, we should reprogram in that isn't good enough.
    No question that a programming languages course has value. However, that wasn't even my point. My point was that pushing students into Pascal as a first language is a bad idea. I've already stated the reasons. Then as support for your reasons you jump to a programming language class (something that was a senior level class at my Uni). :ugh:

    I never made a claim about the difficulty of that code or language or even implied it.
    Congrats, too bad reading comprehension owns you.
    :fawk:
     
  15. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    0
    Location:
    OKC
    I'm referring to the first language that students learn. You're way down the line, just like your last post and YES, syntax confusion for newer students SHOULD be considered.

    I know, I know, you didn't have any issues in this regard and noone else should either so by your ideas, anyone that does have issues is a fucking idiot. My attitude is based more on my experiences and those of other students.

    Very often, students would get confused when they moved into their very next class. It would be better to save these sorts of issues till the confidence of the students is higher (i.e. later in their degree).
    no where did I ever make the claim that programmers should limit their exposure to other languages. Reading is owning you again here.
    :rofl: :wtf:
    Programmers that use Java will NOT find themselves out of a job is they learn pascal? :rofl:

    Drink more beer mmkay.
     
  16. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,489
    Likes Received:
    70
    Location:
    Sparkopolis
    dude, you should get your own reading comprehension checked before attacking mine.
    I never said that Pascal should be taught as a first language or even that it deserved its own course. You said "they STILL teach pascal in school?", then deusexaethera said "It's important to teach the concepts in a language that has no practical use, because that way people don't marry the concepts to the language." to which you replied "IMO you're overstating the benefits and totally ignoring the potential downsides." I then posted my own account of using older languages like Pascal to learn concepts and I commented that it was not the problem that you made it out to be.

    1. companies don't pick languages. people do. at every company that you think "picked a language", there was a person at the company that made the decision. if that person was more informed, bad languages would go away.
    2. I never claimed that Pascal SHOULD be used as a first language, so I didn't "jump to" anything. I replied to a conversation about using older languages to teach concepts, and my point was that it CAN be used to teach concepts, so I explicitly outlined a situation in my personal experience where it was
    3. I said "you guys", not "Coottie"
    Maybe you should get your writing skills checked out, too
     
  17. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    If you're confused by syntactic differences between languages, you're a noob and you'll get over it as you gain experience. If you're bothered by that confusion, then you have no business being a programmer. I'm sorry, I don't want to be an ass about it, but a programmer who is bothered by something as superficial as syntax (when there are far more difficult and clunky differences between languages) is going to be about as effective as an interpreter who gets pissed off that Chinese doesn't have the same exact vocabulary as English. Sorry bro, that's part of the deal.

    Also, Pascal is used as an educational language in high school, not in college (or at least, I've never seen it in college, except maybe in the very beginning of IS-101); if you're actually going to become a programmer, you're going to have to endure a few more years of education before you will be even slightly employable, so there's no reason to be impatient -- and if you are that impatient, you can always school yourself in whatever language you want alongside your formal education. I myself started programming when I was 12; hell, I don't know a single programmer worth his salt who actually learned everything he knows about programming just from school.

    - - -

    All I was trying to say in my original point is that Pascal is useful as an educational language specifically because it is useless in the real world, so nobody who learns Pascal is going to have problems with having the concepts they learned in Pascal class being inextricably tied to the syntax of the language itself in their minds.
     
  18. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    0
    Location:
    OKC
    Well you are being an ass about it but I've come to expect that from this place.

    Syntactic confusion when someone is new to programming is not a good thing. Build up their confidence, let them learn a language thoroughly THEN introduce other languages. Introducing many languages early in a degree is not the best way to teach IMO.

    Yes as one gets more versed, it should be less of an issue but it's still there even among very seasoned programmers. The similarities between C++ and Java is one area that repeatedly causes problems in school....at least at my Uni it did. However, as one enters the work force and begins to focus more, these difference diminish but they can still be present.

    Very few people have perfect recall and confusion isn't an unnatural thing. As they say, practice makes perfect

    In Uni, pascal was my first language and yes, it caused people problems as we progressed in our degree. I was sufficiently motivated that I didn't suffer the same levels of confusion but they were still there.

    :rofl:
    This is idiotic in the extreme.
     
  19. Limp_Brisket

    Limp_Brisket New Member

    Joined:
    Jan 2, 2006
    Messages:
    48,422
    Likes Received:
    0
    Location:
    Utah
    i never had any pascal class of any kind and i'm a programming genius, so you can all stop arguing now.
     
  20. critter783

    critter783 OT Supporter

    Joined:
    Jul 15, 2005
    Messages:
    1,785
    Likes Received:
    0
    If you can't separate the concepts from the language, then you don't understand the concepts. If you understand the concept, then you can write it out as pseudocode. If you can write it as pseudocode, you can study the syntax and write it in any language. Its as simple as that.
     
  21. trouphaz

    trouphaz New Member

    Joined:
    Sep 22, 2003
    Messages:
    2,666
    Likes Received:
    0
    i think they teach pascal in college still because it is a useless language and college can't teach you anything practical. i remember for my CS degree, the only programming class i took where they actually taught you programming was in pascal. the first class they taught you pascal and then the second class they taught you concepts and you had to figure out for yourself how to do it in C++.

    anyway, that's where i decided that i hated programming and decided to stick with shell scripting and be a sys admin. :)
     
  22. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Bingo.

    Some people don't like the idea that true comprehension is hard to achieve.
     
  23. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Well, I can't help what you think. But the consensus is, you're wrong.
     
  24. critter783

    critter783 OT Supporter

    Joined:
    Jul 15, 2005
    Messages:
    1,785
    Likes Received:
    0
    This is part of the idea. So, if you want to give students a chance to learn a language thoroughly, many professors would argue that its best to start with a language that has a very small set of syntax rules to learn. Pascal fits the bill nicely.
     
  25. Limp_Brisket

    Limp_Brisket New Member

    Joined:
    Jan 2, 2006
    Messages:
    48,422
    Likes Received:
    0
    Location:
    Utah
    i don't know what crappy kind of computer science program you were in but in my university all the introductory programming classes were in Java and C++.
     

Share This Page