我在第 41 行有一个错误:“int”之前的预期表达式 第 45 行:建议在“&”的操作数中使用括号来比较
我还想确定 43-45 中的代码是否有意义。
我是第一次在这个论坛上发帖,我是 C 的新手,所以请忍受这篇文章的业余性质
#include<stdio.h>
#include<math.h>
int main(void)
{
// LOCAL DECLARATIONS
int bricks; //the number of bricks available
int spheres; //the number of spheres available
int prisms; //the number of prisms available
int final_string(int bricks, int spheres, int prisms); //the longest possible string with the given shapes in an alternating fashion
// EXECUTABLE STATEMENTS
printf("\nEnter the number of bricks: ");
scanf("%d", &bricks);
printf("Enter the number of spheres: ");
scanf("%d", &spheres);
printf("Enter the number of prisms: ");
scanf("%d", &prisms);
printf("\nLongest possible string of alternating shapes usuing only two different shapes: %d", int final_string(int bricks, int spheres, int prisms));
int final_string(int bricks,int spheres,int prisms);
{
return bricks * (bricks > spheres & bricks > prisms) + spheres * (spheres > bricks & spheres > prisms) + prisms * (prisms > bricks & prisms > spheres);
}
return(0);