Programming in C Create your own designs using the shapes provided in the function definitions Source Code provided: #in
Posted: Fri Jul 01, 2022 5:51 am
Programming in C
Create your own designs using the shapes provided in thefunction definitions
Source Code provided:
#include <stdio.h>
//Step 1: function prototypes
//the prototypes needed for the stick figure program(game)
void circle(void);
void triangle(void);
void horiz_line(void);
void parallel();
int main()
{
//step 3: function calls
//Through different variations of function calls you can createother figures
circle();
horiz_line();
triangle();
horiz_line();
parallel();
printf("\n\n\n");
triangle();
horiz_line();
parallel();
horiz_line();
return 0;
}
//step 2: function definition
void circle(void)
{
printf(" * * \n");
printf(" * *\n");
printf(" * *\n");
}
void triangle(void)
{
printf(" /\\ \n");
printf(" / \\ \n");
printf(" / \\ \n");
printf("/ \\ \n");
}
void horiz_line(void)
{
printf("---------\n");
}
void parallel()
{
printf("| |\n");
printf("| |\n");
printf("| |\n");
printf("| |\n");
}
Create your own designs using the shapes provided in thefunction definitions
Source Code provided:
#include <stdio.h>
//Step 1: function prototypes
//the prototypes needed for the stick figure program(game)
void circle(void);
void triangle(void);
void horiz_line(void);
void parallel();
int main()
{
//step 3: function calls
//Through different variations of function calls you can createother figures
circle();
horiz_line();
triangle();
horiz_line();
parallel();
printf("\n\n\n");
triangle();
horiz_line();
parallel();
horiz_line();
return 0;
}
//step 2: function definition
void circle(void)
{
printf(" * * \n");
printf(" * *\n");
printf(" * *\n");
}
void triangle(void)
{
printf(" /\\ \n");
printf(" / \\ \n");
printf(" / \\ \n");
printf("/ \\ \n");
}
void horiz_line(void)
{
printf("---------\n");
}
void parallel()
{
printf("| |\n");
printf("| |\n");
printf("| |\n");
printf("| |\n");
}