27 lines
516 B
C
27 lines
516 B
C
#include <stdio.h>
|
|
#include <stdbool.h> //provides a boolean datatype bool to save the values true or false
|
|
|
|
int main()
|
|
{
|
|
int CurrentFloor = 0;
|
|
int TopFloor = 10;
|
|
|
|
bool GoingUp = true;
|
|
|
|
for(int Timestep = 0; Timestep < 15; Timestep++)
|
|
{
|
|
printf("I'm currently at floor %d\n", CurrentFloor);
|
|
if(GoingUp)
|
|
{
|
|
CurrentFloor++;
|
|
}
|
|
else
|
|
{
|
|
CurrentFloor--;
|
|
}
|
|
|
|
// TODO: check if we reached the top floor and set the GoingUp variable to the appropiate value
|
|
// (true for up and false for down)
|
|
}
|
|
}
|