I don't think I have using the whole "%" and "int" thing properly? I'm also not sure how to remove the formatting from the error message in this forum post, sorry.
Here is my code:
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main (void)
{
int LengthOfShower;
do
{
// Prompt user for length of their shower (minutes)
printf("How many minutes do your showers last?");
LengthOfShower = GetInt();
}
while (LengthOfShower < 0);
// Calculate how many bottle equals their length of shower
int NumberOfBottles = LengthOfShower * 12;
// Print the number of bottles they use in their shower
printf("Bottles: %f, NumberOfBottles");
}
When I try to compile it I get these two error messages:
$ make water
clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wshadow water.c -lcs50 -lm -o water
water.c:20:23: error: more '%' conversions than data arguments
[-Werror,-Wformat]
printf("Bottles: %f, NumberOfBottles");
~^
water.c:17:9: error: unused variable 'NumberOfBottles'
[-Werror,-Wunused-variable]
int NumberOfBottles = LengthOfShower * 12;
^
2 errors generated.
make: *** [water] Error 1