Tutorial sheet 1 - CLion Software and design (2) (1)
Tutorial sheet 1 - CLion Software and design (2) (1)
Description Exercises - Week 1 will look at software design and use CLion for the
first time.
References Lecture 1 (Blackboard)
C Programming: A Modern Approach, 2nd Edition by K. N. King
Supplementary Study Material Folder
Mandatory exercises 1,2,3,4,5 (6 is optional)
Note: all exercises to be completed individually, unless specified!
Exercise 1(*): Write pseudocode to describe how to cook your group’s favourite meal.
Consider what ingredients/equipment is needed, what steps and duration of these steps
and how they might be done in a logical order.
Perform in small groups. In your log book, record who you worked with.
Exercise 2(*): Draw (by hand and clearly photographed is fine but see supplementary material
folder for some online tools) a flow chart to describe how aircon in your car works.
Perform in small groups. In your log book, record who you worked with.
Exercise 3(*): Create a new project in CLion and paste the text below into CLion and
run the program. Screenshot each step in the process.
/* Filename: MysterySoftware.c
Description: Figure out what I do!
Author: Module Team
Date: 29/9/24
Input/output: None
Version: 1
*/
#include <stdio.h>
int main(void) {
printf("You just ran your first C program, good job!");
return 0;
}
Exercise 4 (**): Write pseudocode or a flow chart that asks the user to enter the value of
speed in metres per second, converting it to miles per hour then displays it to the user.
Exercise 5(**): Write pseudocode that takes as input, the progress submissions 1 and 2,
Logbook, mini coursework (development log) and exam marks for this module for a
student, then calculates their overall module mark and identifies if any tasks need to be
resit (with a mark of 39% or less).
Hint: Check the module handbook, or lecture 1 for the marks breakdown.
Exercise 6(*): Copy and paste the following code into CLion and run it. The code is
designed to take 2 numbers from the user, add them together and tell the user if the sum
of the two numbers is positive, negative or zero.
Identify were the software does not work as expected (use the test form to perform these
tests, list the inputs you gave as user and the expected vs actual output and try to identify
where it might be wrong. Ignore the code itself.
#include <stdio.h>
int main() {
int num1, num2, sum;
while(1){
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
sum = num1 + num2;