create new tag
view all tags

Session 2: Basic C programming

PC systems:

Check if new updates have arrived and if yes install them on all machines

  • apt update

  • apt upgrade

Install gnuplot and eclipse on all machines If there is time install CDT, the development perspective for C/C++into eclipse. Do eclipse installation only at the end of the session.

Check if ssh works from any to any machine. If not install openssh-server on all machines. The ssh client should be there, but please check. Go to one machine where you are sure sshd is working and log into all the other machines one by one.

Make a list of MAC and IP addresses for all of the machines. Are they fix or do they change from one day to the next?

If they are fixed, then edit the /etc/hosts files and add IP addresses and host names for all of the machines. Do this on one machine only. Then you may copy this file to /tmp of another machine using scp and edit the /etc/host file there using cut and past from the copied file.

If the IP addresses change then we will have to talk to out network friends and ask them to enter fixed IP addresses for these machines in the DHCP server.

Student exercises

Go through the student exercises and check how far they can get in a single exercise session. I presume that we will have to shift the last exercise (sine function) to the next session?

We have a problem with the lecturers' user names: The Ubuntu OS has been re-installed on Monday, replacing the previous 32 bit OS by a 64 bit one. Your files are still all there but your users have gone and I cannot re-create them because I do not know the passwords.

Please call me in to re-install your user and give you back access to your files. Sorry for the inconvenience, however, we had to do this because the 32 bit system is deprecated (even though still supported for the moment) while the 64 bit system is the one that will be further developed.

Ike has asked the students to solve the exercise on the calculator as home work. I have received 6 answers (out of 15) and I have picked one of the solutions at random and attached the files as I have received them from the student. The files are:

  • calculator.c
  • divide.c
  • mult.c
  • plus.c
  • sub.c
First of all I would congratulate the student that he has actually done the work and sent it in.

From the lecturers I would like to know, which improvements to the solution can be made.

Then please try the multiplication: calculator num1 * num2 does not work! while all the other operations do work perfectly. What is the problem?

I have added a few more code examples and renamed the tar.gz file to newCodeExamples.tar.gz. Download this and unpack it. Have a look at textAndData and analyze the code. Do you understand everything and are you able to explain this to the students?

Then there is a directory called lottery. Have a look at the code in lotteryLux.c and analyze it. What is it supposed to do and how does it try to accomplish the task?

Finally do the last C programming exercise, look at the output file, which should be in text format. Can you plot the results in libreOffice and with gnuplot?

Can the students do the calculator and the sine exercise within 3 h?

-- Uli Raich - 2017-09-11


Topic attachments
I Attachment History Action Size Date Who Comment
C source code filec calculator.c r1 manage 0.3 K 2017-09-20 - 10:48 UnknownUser  
C source code filec divide.c r1 manage 0.3 K 2017-09-20 - 10:48 UnknownUser  
C source code filec mult.c r1 manage 0.3 K 2017-09-20 - 10:48 UnknownUser  
C source code filec plus.c r1 manage 0.3 K 2017-09-20 - 10:48 UnknownUser  
C source code filec sub.c r1 manage 0.3 K 2017-09-20 - 10:48 UnknownUser  
Unknown file formatodt tutor_2_v2.odt r1 manage 21.4 K 2017-09-20 - 11:15 UnknownUser  
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2017-09-20 - uli
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback