有人可以帮我解决这个错误吗,当我在 C 中编译我的代码时,我收到以下错误消息:
error: too few arguments to function call, at least argument 'format' must be specified
如何为我的论点添加格式?我的论点应该采用哪种格式?
下面是我的代码:
#include <stdio.h>
#include <cs50.h>
#include <math.h>
#include <string.h>
bool valid_triangle(float a, float b, float c);
int main(void)
{
printf("give me the first side of the triangle: \n");
float a = get_float();
printf("give me the second side of the triangle: \n");
float b = get_float();
printf("give me the third side of the triangle: \n");
float c = get_float();
bool i = valid_triangle ( a, b, c);
if (i == true);
{
printf("triangle is true: \n");
}
if (i == false);
{
printf("triangle is false: \n");
}
}
bool valid_triangle(float a, float b, float c)
{
if (a<=0 || b<=0 || c<=0) // check for all positive sides
{
return false;
}
if ((a+b<=c || a+c<=b || b+c<=a)) // check that the sum of any two length is greater than the length of the third one
{
return false;
}
return true; //if both tests are negative, the result is true
}