Engineering Programming ESEMSc
Engineering Programming ESEMSc
Engineering Programming ESEMSc
Semester 1, 2022/23
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
Week Seminar
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
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;
#include <stdio.h>
main(){
float x, y;
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
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)