Group Paper Info for CSE-428
Click the link below to jump to a person's contribution:
Our Paper(with Cherise's foot note)
The following will compare and contrast several different languages in regards to the function file input/output. The following is a short description of each language and it’s basic appearance.
C+ is based on streams that can be redirected through pipes. This is a way for programs to talk to each other and to interact with the file system. It is often implicit, through referencing standard input/output functions, not explicit. C+ also imposes structure onto the file stream. Files can only be opened in binary form unlike Visual Basic and Fortran. C+, similar to Visual Basic has specific functions to open and close files.
Pascal is a strongly typed language in the sense that all variable need to be dimensioned.
Visual Basic, like C+, has specific functions to open and close and file. The following chart will depict this. Files, not only can be opened in binary, as C+ does, but also can be opened as a text file and sequential file.
Fox Pro is a cursor based language. It can create records based from a file. It can seek out records in files and not just in a bite stream as in C+.
The following is a chart that depicts the similarities and differences between six different languages and various functions.
|
OPEN |
CLOSE |
READ |
READLINE |
WRITE |
WRITELINE |
RECORD TYPE |
|
|
PASCAL |
RESET |
READ |
READLN |
WRITE |
WRITELN |
||
|
FORTRAN |
OPEN |
CLOSE |
READ |
WRITE |
FORMATTED, UNFORMATTED, BINARY |
||
|
C+ |
FOPEN |
FCLOSE |
FGETC |
FGETS |
FPUTC |
FPRINTF |
BINARY (ALL THE SAME) |
|
VISUAL BASIC |
OPEN |
CLOSE |
LINEINPUT |
WRITE |
|
TEXT,BINARY |
|
|
PERL |
|||||||
|
FOXPRO |
CREATE CURSSOR |
CLOSE |
APPEND |
COPY |
CURSOR BASED |
Parsing is a very useful technique in many different languages. The main premise behind parsing is simply taking a string or set of information and breaking it down into a smaller, more specific section. It can be used to get information from files, reports, databases, and several other formats.
Various languages handle parsing differently and there are pros and cons to each. Parsing is done as part of the select and where statements in SQL. This is the part of the code that allows you to tell it what specific data you would like as output. The where clause, which is optional specifies which data values or rows will be returned or displayed, based on the criteria described after the keyword where. This type of parsing can be done using as little as eight words, as long as there is a valid data table to query from. Parsing in VB is a little more complicated. VB has powerful string parsing functions, but you have to build the parsing logic, since nothing is built into VB specifically to do this. Perl on the other hand has some parsing logic built into the language. This allows for much easier use of the technique. To parse a string in Perl is a simple task. C++ also has the capability to parse and can be done manually or through functions. This flexibility is a great advantage to have when attempting to parse information. Parsing in FoxPro shares some similar characteristics as parsing in SQL. FoxPro uses simple statements to query from programs in a preset format. This is unlike VB which uses tokens and if else statements. All of the languages have different parsing syntax. They all use keywords in one way or another along with the proper syntax to create the proper code. Many of our mistakes and problems were a result of syntax errors and not the concepts, which can become quite frustrating, especially when the errors are not easily identified. The VB, Perl, and FoxPro codes have the advantage of debugging over SQL in our case. The SQL that was generated was tested using an online SQL interpreter. This interpreter would only send back a one-line error message when the code would not execute properly and would not tell the user what line, error, or suggest a solution.
Overall the SQL, Perl, and FoxPro scripts were the most desirable, easy to use, and easiest to generate. The VB, C++, and SQL seem to be more powerful languages for expansiveness and more complex functions. We attempted to accomplish parsing in Pascal, but were unable to get the code to parse properly. That led us to believe that parsing was the most complicated in Pascal. C++ has the advantage in terms of overall flexibility, but if we were forced to choose only one language for parsing, we would pick SQL. The main reason being that, simple scripts can easily generate very specific data in many formats. We realize that this can be done using all the languages, but to us SQL was the easiest to learn and practice.
Looping is a very important step of a program in almost every language uses loops to do iterations in one step or through many steps, one time or many times until the condition(s) met.
In C language there are many different loops and it can be finite and also infinite. For and while loops in C language infinite loops. It can be finite when you use statement “break;” to stop the iteration. Especially in basic language goto statement is a must for different iterations to be fulfilled. In C, these loops are taking away the goto statement completely. There for looping is a better way or a short cut to the programmer.
/ Do While Loop */
# include <stdio.h>
main ()
{
int i;
i =65;
do{
printf("the numeric value of %c is %d. \n', i,i);
i++;
while (i<92);
return 0;
}
As you can see C has starting and ending brackets for loops. This will gives the message to the compiler staring and eding positions of the loop.
In Visual Fox Pro there are three commands will allow loping such as SCAN……ENDSCAN, FOR……..ENDFOR AND DO WHILE………ENDDO.
The do while loop in C is ending with a statement by (;). This statement controls the do while loop, and at least once this loop will be executed.
My comparison to SQL for looping with limited and looping in PL/SQL ” Procedural language/structured query language” is somewhat similar to C loops. Also has a WHILE loop and a FOR loop. In SQL loops are created with
BEGIN
LOOP
<loop_body>/* A list of statements. */
END LOOP;
END;
At least one of the statements in <loop_body> should be an EXIT statement of the form
EXIT WHEN <condition>;
If the condition is true loop will break.
Therefore WHILE LOOP can be set as
WHILE <condition> LOOP
<loop_body>
END LOOP;
FOR <var> IN <start>…<finish> LOOP /* var can be any local variable*/
/*start and finish are the constants*/
<loop_body>
END LOOP;
Difference between C and SQL: FOR LOOP does not have conditions to meet in SQL and C you must have a condition in order to run the for loop. PL/SQL has simple English of easy to read capabilities within the loops and it tell you where is the beginning and the end of the loop.
In PEARL language if and else considered as a loop and in C If and else considered as a statement. In C if also can have nested statements within the main if statement. It is easy to read pearl language than C.
In Visual Basic there are multiple loops:
if then else if
If condition Then
some_instructions
ElseIf condition Then
some_instructions
ElseIf condition Then
some_instructions
Else
some_instructions
End If
Repeating code using loops like For-Next, While-Wend, and Do-Loop.
In Pascal Language The most important thing to notice is that each loop is controlled by its own separate control variable.
Loops can be nested to any desired level. However, such nesting can make the program more difficult to read and debug. A common sense rule to follow is to use a MAXIMUM OF TWO levels of nesting. I am not sure this is a norm for pascal or not.
Conclusion:
In my experience any langauage that you use you need to learn the concepts and how it works. Just like we have learn some languages works from left to right and others work right to left. If you know these concepts you can get the same answer by using any different language.
An array is a structure that holds many “elements” of the same data type. An array of elements can consist of, but is not limited to data types in the form of variables, characters, or integers. Arrays are a good feature to use because they allow the user to access a list of information without inputting each value individually.
The computer languages SQL, VB, Perl, Visual FoxPro, C and Pascal all have the ability to process an array of data. SQL is perhaps the simplest language that one can use to write and read an array. Using SQL, the data is inputted into a chart using a comma separated array format. The information is then displayed in an array format of columns and rows. Using SQL however, it is uncertain whether or not there is a specific array input or output function.
Programming in VB, Perl, Visual FoxPro, C and Pascal allows you to write and read arrays that are not in the chart format. Some of the pros and cons with these languages are its ability to set upper and lower bounds, to accommodate multiple dimension arrays and to access the arrays through a pointers. VB, Visual FoxPro, C and Pascal can all support multiple arrays. However, when setting the upper and lower bounds, there are some limitations, which occurs in some of the programming languages. VB has an option base syntax, which allows an array to be defined with only the upper bound. Also, it has the capability to set the lower bound to any value unlike C and Pascal where the lower bound is always set to zero. However, unlike C and Pascal, VB does not have the capability to access an array through pointers. Consequential, VB is often time consuming compared to other programming languages when the user wishes to locate a particular place in an array.