У меня возникла проблема для программы im для компьютера II класса. Интересно, помогли бы вы, ребята, меня. Прошло около двух лет с тех пор, как я получил компьютерную науку, поэтому не стану напрягать меня, если что-то легко.Ошибки компиляции в C
в любом случае, это код, который у меня есть;
#include<stdio.h>
#include <stdarg.h>
/*The purpose of this program is to be able to enter 4 numbers
and let the program tell you which number the the largest, which
number is the smallest, and then multiply the first 3 numbers together
and then divides by the 4th one. once doe it will print the results.
The main goal is to help you understand pointers*/
int main()
{
int a, b, c, d = 0;
int result;
printf("Enter the 4 numbers"); //instructions
scanf("%d%d%d%d", &a, &b, &c, &d); //collects 4 numbers
result = (a*b*c)/d;
max(int *a, int *b, int *c, int *d, int *result); //prints the max of the 4 numbers
min(int *a, int *b, int *c, int *d, int *result); //prints the min of the 4 numbers
return 0;
}
void max(int *a, int *b, int *c, int *d, int *result)
{
if(a > b && a > c && a > d)
{
printf("The max is %d. ", a);
}
if(b > a && b > c && b > d)
{
printf("The max is %d. ", b);
}
if(c > a && c > b && c > d)
{
printf("The max is %d. ", c);
}
if(d > a && d > b && d > c)
{
printf("The max is %d. ", d);
}
}
void min (int *a, int *b, int *c, int *d, int *result)
{
if(a < b && a < c && a < d)
{
printf("The min is %d. ", a);
}
if(b < a && b < c && b < d)
{
printf("The min is %d. ", b);
}
if(c < a && c < b && c < d)
{
printf("The min is %d. ", c);
}
if(d < a && d < b && d < c)
{
printf("The min is %d. ", d);
}
}
void mul (int *a, int *b, int *c, int *d, int *result)
{
printf("(a * b * c)/d = %d\n", result);
}
Вот ошибки, которые я получаю;
lab1.c: In function 'main':
lab1.c:20:6: error: expected expression before 'int'
lab1.c:21:6: error: expected expression before 'int'
lab1.c: At top level:
lab1.c:26:6: warning: conflicting types for 'max' [enabled by default]
lab1.c:20:2: note: previous implicit declaration of 'max' was here
lab1.c:51:6: warning: conflicting types for 'min' [enabled by default]
lab1.c:21:2: note: previous implicit declaration of 'min' was here
Любая помощь !?
Этот вопрос не соответствует теме, поскольку это всего лишь свалка кода с некоторыми ошибками. Это не прикладывает усилий для решения проблемы. – Almo
Те начальные части вашего кода показывают, что вы знаете, как вызвать функцию в C. Почему тогда вы сбросили эти бессмысленные 'max (int * a, int * b, int * c, int * d, int * result)' линии в середине вашего кода? Что вы пытались сделать по этим линиям? – AnT
@ Алмо: О, пожалуйста. Это новичок, который не понимает ошибок. Почему вы предположили, что он не пробовал? Yeesh, дать парню перерыв и помочь ему. По крайней мере, он опубликовал свой код и выводит ошибку. –