
-----------------------------------
cwarrior
Sun Mar 29, 2009 9:49 pm

C program help
-----------------------------------
Basically i have to write a program that will draw a face. like this one:
    
   [code]    
         hhh
     hhhhhhhhh
  hhh           hhh
hhhh  O   O  hhhh
  hhh     o     hhh
   hh   \__/   hh
     h            h
     hhhhhhhhh
[/code]

and i have to write the inside of the face in a function that takes 1 to draw the eyes 2 to draw the nose and 3 to draw the mouth
This is what i got:

[code]
#include 
face(int line);
main()
{
char c = 'h';

printf("%7c%c%c \n",c,c,c);
printf("%4c%c%c%c%c%c%c%c%c \n",c,c,c,c,c,c,c,c,c);
printf("%2c%c%c%8c%c%c \n",c,c,c,c,c,c);

printf("%c%c%c%c%c%8c%c%c%c \n",c,c,c,c,face(1),c,c,c,c);
printf("%2c%c%c%8c%c%c \n",c,c,c,c,c,c);
printf("%3c%c%8c%c \n",c,c,c,c);
printf("%4c%8c \n",c,c);
printf("%4c%c%c%c%c%c%c%c%c \n",c,c,c,c,c,c,c,c,c);


}
face(int line)
{
  
  if(line == 1)
    printf(" o   o ");
  else if (line == 2)
    printf("   o   ");
  else if (line == 3)
    printf("  -   ");
}	  	  	  
[/code]	  

I do not know how to put the function face in the main so that it displays each line properly. As you guys see I have done work I just need help with that. Thanks in advance.

-----------------------------------
Unforgiven
Mon Mar 30, 2009 6:34 pm

RE:C program help
-----------------------------------
I'm a little unclear on what you're asking. I thought you meant you didn't know how to call a function in main(), but you did, once. 

Can you explain a little more? Or, did you just mean you weren't sure *where* to call it?

-----------------------------------
cwarrior
Mon Mar 30, 2009 6:50 pm

Re: C program help
-----------------------------------
yes where do I call it so that it prints the eyes with 1, the nose with 2, and the mouth with 3?

-----------------------------------
rdrake
Tue Mar 31, 2009 10:30 am

RE:C program help
-----------------------------------
Isn't there already this exact same question asked in a different forum?  You've already done this once.  Just stick to the single topic in the C forum where it belongs.

Another warning for you.
