#include void smile(void); void smile(void) { ; } int main(int argc, char * argv
ID: 668813 • Letter: #
Question
#include
void smile(void);
void smile(void)
{
;
}
int main(int argc, char * argv[])
{
printf(" **** * . .* * * * \_/ * * * **** ");
return 0;
}
So the goal of this assignment is to have a smiley face show up 3 times. I managed to make the face, but how do I get the main program to make the face to show up two more times with a line inbetween them on top of each other? Am I on the right track? Essentially I'm trying to write a simple function called "smile", with return prototype "void" and no parameter. Do I have to specify no parameter somewhere?
return_type function_name(parameter list); … int main (void) { … function_nume(argument list); … } return_type function_name(parameter list) { function body }
How would I include this?
Explanation / Answer
Execute the below program and you will be able to see Smiley face upto 3 times as i have defined Smiley face in Smile funciton with no return type and no parameter and i am calling this function in main method. I am calling this function in a loop upto 3 times as you want to print Smiley face three times.So ,you can print it for any number of times.
#include<stdio.h>
void smile(void);
void smile()
{
printf(" **** * . .* * * * \_/ * * * **** ");
}
int main(int argc, char * argv[])
{
int i;
for(i=0;i<=2;i++)
{
smile();
printf("====================== ");
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.