Intro2ProgrammingWeek2

Some popular interpreted languages include basic

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
then execute as the program is running. Some popular interpreted languages include Basic, Visual Basic, Perl and shell scripting languages such as those found in the UNIX, Linux and MacOS X environment. We can make another comparison between two different models of programming. In structured programming , blocks of programming statements (code) are executed one after another. Control statements change which blocks of code are executed next. In object oriented programming, data are contained in objects and are accessed using special methods (blocks of code) specific to the type of object. There is no single “flow” of the program as objects can freely interact with one another by passing messages. Program Structure Virtually all structured programs share a similar overall structure: Statements to establish the start of the program Variable declaration Program statements (blocks of code) The following is a simple example of a program written in several different programming languages. We call this the “Hello World” example since all the program does is print “Hello World” on the computer screen. Language Example program “C” #include <stdio.h>void main() { printf("Hello World"); }
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C++ #include <iostream>int main() { cout << "Hello World"; return 0; } Pascal program helloworld (output);begin writeln('Hello World'); end. Oracle PL/SQL CREATE OR REPLACE PROCEDURE helloworld AS BEGIN DBMS_OUTPUT.PUT_LINE('Hello World'); END; Java class helloworld { public static void main (String args []) { System.out.println ("Hello World"); } } Perl #!/usr/local/bin/perl -w print "Hello World"; Basic print "Hello World" Note that the Perl and Basic languages are technically not compiled languages. These language statements are “interpreted” as the program is running.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern