I need help finding the error. the error messages i keep getting are:
shapes.c:13: warning: parameter names (without types) in function declaration
shapes.c:14: warning: parameter names (without types) in function declaration
shapes.c: In function âmainâ:
shapes.c:42: error: expected expression before â)â token
shapes.c:44: error: âblanksâ undeclared (first use in this function)
shapes.c:44: error: (Each undeclared identifier is reported only once
shapes.c:44: error: for each function it appears in.)
shapes.c:49: error: redeclaration of âiâ with no linkage
shapes.c:43: note: previous declaration of âiâ was here
shapes.c:50: error: âstarsâ undeclared (first use in this function)
shapes.c:64:10: warning: missing terminating " character
shapes.c: In function âdisplay_greeting_messageâ:
shapes.c:64: error: missing terminating " character
shapes.c:65: error: âPRINTERiâ undeclared (first use in this function)
shapes.c:65: error: stray â\â in program
shapes.c:65:30: warning: missing terminating " character
shapes.c:65: error: missing terminating " character
shapes.c:65: error: ânâ undeclared (first use in this function)
shapes.c:66: error: expected â)â before âprintfâ
shapes.c:67:10: warning: missing terminating " character
shapes.c:67: error: missing terminating " character
shapes.c:68: error: stray â\â in program
shapes.c:68:10: warning: missing terminating " character
shapes.c:68: error: missing terminating " character
shapes.c:86: error: expected â;â before â}â token
heres the code.
/* Prints a shape for the code user chooses
*/
#include
void display_greeting_message();
void print_square();
void print_triangle();
void print_diamond();
void display_goodbye_message();
void print_blanks(blanks );
void print_stars(stars );
int main()
{
int code;
int l = 0;
do{
display_greeting_message();
printf("Please enter your code now: ");
scanf("%d", &code);
if (code == 1)
{
print_square();
}
if(code == 2)
{
print_triangle();
}
if (code == 3)
{
print_diamond();
}
if (code == 0)
{
display_goodbye_messgae();
}
}
while (l==));
int i;
for (i=1; i
{
print_blanks(blanks);
printf(" ");
}
int i;
for(i=1; i<=>
{
print_stars(stars);
printf("*");
}
void display_greeting_message()
{
printf("*************************************************************\n");
printf("*************WELCOME TO THE PATTERN
PRINTERi****************** \n");
printf("* Enter a code 1 to print a square pattern of starts \t * \n");
printf("* Enter a code of 2 to print a right triangle pattern of
stars* \n");
printf("* Enter a code of 3 to print a diamond pattern of stars\t*\n");
printf("* Enter a code of 0 to stop printing patternst\t *\n");
printf("* t\t\t\t\t*\n");
printf
("************************************************************\n");
}
void print_square()
{
int side,i;
print("Enter the size of the square (integer): ");
scanf("%d", &side);
for (i=1; i
{
print_stars(side);
print"\n");
}
}
void print_triange()
{
int base,i;
printf("Enter the base of the triangle (integer) : ");
scanf("%d", &base);
int star = 1, space =0;
space = base/2;
if (base %2 ==0)
{
while(star
{ print_blanks(space);
print_stars(star);
printf("\n");
space = space-1;
if(star ==1)
star = star + 1;
else
star = star + 2;
}
}
else
{
while(star
{
print_blanks(space);
print_stars(star);
printf("\n");
space = space -1;
star = star +2;
}
}
}
void print_diamond()
{
int width, i;
printf("Enter the width of the diamond (integer): ");
scanf("%d", &width);
int star = 1, space = 0;
space = width/2;
if(width %2 == 0)
{
while(star
{
print_blanks(space);
print_stars(star);
print("\n");
space = space -1;
if(star == 1)
star = star +1;
else
star = star +2;
}
if(star == 3)
star = star - 1;
else
star = star -2;
}
else
{
while(star
{
print_blanks(space);
print_stars(star);
printf("\n");
space = space - 1;
star = star +2;
}
star = star -2;
}
space = 1;
if (width %2 ==0)
star = star -1;
else
star = star - 2;
while(star>=1)
{
print_blanks(space);
print_stars(star);
printf("\n");
space = space +1;
star = star -2;
}
}
void display_goodbye_message()
{
printf("**********************************************************\n");
printf("* \t \t GOOD BYE!!!\t\t\t*\n");
printf("**********************************************************\n");
}
=>