icp/oer/courses/c-newcomers/sections/04-supermarket/01-while-loop/program.c

26 lines
527 B
C

#include <stdio.h>
#include <stdbool.h>
int main()
{
bool CustomerHasItems = true;
int CustomerItemCount = 5;
/*
* This is a while loop.
* It functions similar to the for-loop,
* but, instead of counting up a variable, it only
* checks for the condition.
*/
while(CustomerHasItems)
{
// TODO: Process the items
printf("Scanning a product. %d to go.\n", CustomerItemCount);
// TODO: check if there are still items to process
// and set CustomerHasItems appropriately
CustomerHasItems = false;
}
}