ENGINEERING PROGRAMMING
MS in Earth Science Engineering
Semester 1, 2022/23
COURSE COMMUNICATION FOLDER
University of Miskolc
Faculty of Earth Science and Engineering
Institute of Geophysics and Geoinformatics
Course datasheet
Course Title: Engineering programming Code:
Responsible department/institute: Institute of
Instructors: Péter Tamás Vass Dr., associate
Geophysics and Geoinformatics / Department of
professor
Geophysics
Type of course: Optional
Position in curriculum (which semester): 3 Pre-requisites (if any) -
No. of contact hours per week (lecture + Type of Assessment (examination/ practical
seminar): 0+2 mark / other): practical mark
Credits: 2 Course: full time
Course Description:
The main objective of the subject is to familiarize the students with the elements of programming
necessary to solve engineering and scientific problems. The course tries to transmit the knowledge
by means of which the algorithms of simpler problems can be constructed and the algorithms can be
implemented in the form of computer programs.
The short curriculum of the subject:
Introduction. Some basic concepts and definitions. The elements, design and descriptions of
algorithms. Main features of programming languages. Fundamental steps of program development.
Making the source codes of simpler problems in C language. Compiling the source codes and
executing as well as testing the programs. Short history and main features of C programming
language. Lexical elements of C programming language. Structure of C programs. Definition of
variables in C programs. Use of constants in C programs. Control structures. Pointers and their
application. Dynamic memory allocation in C programs. Arrays and their application. Standard
library functions. User-defined functions. Text file input and output. Introduction to the use of higher
level programming languages (MATLAB and GNU Octave).
Competencies to evolve:
Knowledge: T4, T5, T6, T7, T10, T12
Ability: K1, K2, K3, K4, K5, K13
Attitude: A1
Autonomy and responsibility:
Assessment and grading:
Conditions for obtaining the signature: attendance at minimum 70 % of the lessons in the semester
and passing two classroom tests.
The determination of the practical mark is based on the evaluation of problem solving in the lessons
and the results of two classroom tests. The weights of the partial achievements: problem solving in
the lessons = 20%, results of the two tests = 40% + 40%.
Grading scale (% value grade): 0 – 49 % 1 (fail), 50 – 64 % 2 (pass),
65 – 79 % 3 (satisfactory), 80 – 89 % 4 (good), 90 – 100 % 5 (excellent).
Compulsory or recommended literature resources:
The presented slides converted in pdf format: http://geofizika.uni-miskolc.hu/segedlet.html
Brian W. Kernigham – Dennis M. Ritchie: C Programming Language, 2nd Edition, Prentice-Hall
Inc., ISBN-10: 0131103628
Clovis L. Tondo, Scott E. Gimpel, 1989: The C Answer Book, Second Edition, Prentice-Hall
International, Inc., ISBN: 7-302-02728-5
John W. Eaton, David Bateman, Søren Hauberg, Rik Wehbring: GNU Octave, A high-level
interactive language for numerical computations, Edition 4 for Octave version 4.0.3
July 2016
MATLAB numerical computing, Tutorials Point (I) Pvt. Ltd., 2014: www.tutorialspoint.com
Syllabus of the semester
Week Seminar
Introduction. Some basic concepts and definitions: computer program, software,
algorithms, constants, variables, attributes of the variables. Elements of the
08/09/2022
algorithms: read, write, assignment, conditional branch, loop. The ways of
expressing algorithms: natural languages, pseudocodes, flowcharts.
Designing and expressing algorithms. Introduction to the use of a free flowchart
15/09/2022
editor. Doing exercises.
General characteristics of high-level programming languages. Semantics,
22/09/2022 syntax, compiler and interpreter. The fundamental steps of program
development.
A short history of C programming language and its general characteristics.
Introduction to the use of a free C and C++ program development environment.
29/09/2022
Writing the source codes of simpler algorithms in C language. Compiling and
testing the implemented C programs.
Lexical elements of C programming language. identifiers, keywords, constants,
comments, operators (precedence and associativity), punctuators. Structure of C
06/10/2022
programs. Data types in C programming language. Defining the variables in C
programs. The use of constants.
Control structures: conditional branches (if, if – else, if – else if – else, switch –
13/10/2022 case), loops (the pre-test loop ’while’, the post-test loop ’do –while’, the for-
loop. Special control statements: break, continue, return.
20/10/2022 Professional day. No education
27/10/2022 No education
The first classroom test on the topics of algorithms and writing simpler C
03/11/2022
programs.
Pointers and their application. Dynamic memory allocation in C programs by
10/11/2022 means of a pointer. Arrays and their application. Strings and character arrays.
Multi-dimensional arrays.
Standard library functions. User-defined functions. Definition, declaration and
17/11/2022
function call.
Text file input and output in C language. Defining a file pointer. Opening a text
24/11/2022
file. Writing, reading and closing a text file.
Introduction to the application of higher level programming languages. The
programming environments of Matlab and GNU Octave. Data types and
01/12/2022
formats. The execution of some important commands. Creating and running
scripts in Matlab and GNU Octave.
08/12/2022 The second classroom test on the topic of C programming.
Sample for the classroom test with the answers
Engineering programming test
date
Task 1
Create a C program which asks the user to type a natural number, computes the factorial of
the number, and displays the result on the monitor.
A computer can be used for implementing the program. Write down the source code of the
program below the flowchart. (max. points: 6)
The flowchart of the algorithm which helps in solving the problem is presented here.
Task 2
Create a C program which asks the user to type two real numbers, compares them, and
determines whether the first number is greater or less than the second one or the two numbers
are equal. It also displays the result of the comparison on the monitor.
A computer can be used for implementing the program. Write down the source code of the
program below the flowchart. (max. points: 8)
The flowchart of the algorithm which helps in solving the problem is presented here.
Sample answer for Task 1
#include <stdio.h>
main(){
int N, i, fact;
printf("The program asks for a natural number, and computes its
factorial.\n");
printf("Please type the number: ");
scanf("%d",&N);
fact=1;
if (N==0)
printf("The factorial of the number: %d", fact);
else if (N<0)
printf("The entered number is not a natural number.");
else{
for (i=1; i<=N; i++)
fact=fact*i;
printf("The factorial of the number: %d", fact);
}
Sample answer for Task 2
#include <stdio.h>
main(){
float x, y;
printf("The program asks for two real numbers, and compares
them.\n");
printf("Please type the first number: x= ");
scanf("%f",&x);
printf("Please type the second number: y= ");
scanf("%f",&y);
if (x>y)
printf("x is greater than y");
else if (x<y)
printf("x is less than y");
else
printf("x is equal to y");
}
Evaluation of the answer for Task 1
Including the necessary header files, the definition of main function and the necessary
variables 2 points
Data input and variable incialization 2 points
Correct application of the control structures 2 points
Evaluation of the answer for Task 2
Including the necessary header files, the definition of main function and the necessary
variables 2 points
Data input 2 points
Correct application of the control structures 3 points
Displaying the result 1 point
Grading scale
range mark
----------------------------------------------------
< 6 ponts fail (1)
6 ponts and < 9 ponts pass (2)
9 ponts and < 11 ponts satisfactory (3)
11 ponts and < 13 ponts good (4)
13 ponts excellent (5)