0% found this document useful (0 votes)
14 views1 page

I2P - Exercises - Assign01

Uploaded by

Sindy Condo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

I2P - Exercises - Assign01

Uploaded by

Sindy Condo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Introduction

to Programming
C and C++ Exercises
Exercise Sheet: 1 https://ubicomp.eti.uni-siegen.de
Due on: 23/10/2023 20:00 100 hours left till deadline /teaching-page Moodle: 17761
Notice: Each source file that you write should start with the following comment header at the top:
/∗ Name:
StudentID:
Description: ∗/

Assignment 1.1 Getting used to the terminal


We will first make sure that you can access your Linux account on our server with an SSH connection. This will be needed to
complete all online programming exercises this semester.
Launch your browser and enter the following URL to access to our system: https://ubi21.informatik.uni-siegen.de/
Log in with your personal credentials and then you will see a terminal window with two panes (one left, one right). Both are
separate views in your home directory on our server. For the first exercise, you only need to use one of them, so you can just
type exit (followed by Enter) in one of the two panes to remove it.
Follow the next steps (see Slide 11 and onwards in the course's slide deck):
Ensure that you are in your home directory. This looks like this: /home/st2023_1234567
Create in this directory a subdirectory ex000 and switch into this directory
Create a file called hello.cpp by launching the nano editor with this file name as parameter
Once in nano, write a valid C++ program. Follow the steps in Slide 16 in the slideset.
Learn to navigate in nano and use the key short cuts. Control-A will show a help screen.
Save, then exit nano by pressing Control-S and Control-Q, to end up at the command line again
Use check in the command line, to verify that your header is correct and your code compiles
Create a sub-directory in the ex000 directory, called myDir, and copy your source code there
Execute check again to verify that your file is copied correctly (check only works in ex000)
The check output will end with a verification whether your code is CPPLINT-compliant
Execute cpplint followed by your source file to see the style errors that it found
Once you have successfully written your source code that shows all green results, you are done

Assignment 1.2 Representing Data: World Population


Write an interactive program that asks the user for the population of a country, and replies with how many percent of the world
population lives in this country. Assume that the world has 7900 million people and, to save typing, ask for the population in
millions as well. Your program could for example look like this (but use your own sentences):
How many inhabitants are in your country (in millions)? 10
Then your country has 0.12658 percent of the world population.
Follow the next steps (see the example from Slide 18 and onwards in the course's slide deck):
Ensure that you are in back your home directory again (e.g., /home/st2023_1234567 )
Create in this directory a subdirectory ex001 and switch into this directory
Once there, start editing a new file hi.cpp with the built-in nano editor.
Create the program as described above, while making sure you indent your code (Slide 21)
Use the check command to see whether you code works 100% as required.

You might also like