Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program print _ faces.c that creates a face based on user input. You will prompt the user to input some characters. These characters

Write a program print_faces.c that creates a face based on user input.
You will prompt the user to input some characters. These characters correspond to different facial features. These features are:
Character Group Feature
'a'
eyes _
O
'b'
eyes ~
O
'c'
eyes \
O
'd'
eyes /
O
'e'
nose ^
'f'
nose ~
'g'
mouth \_/
'h'
mouth /-\
'i'
mouth o
The user will put in the eye preference, then nose, then mouth.
If the user wants the eyes to be different, they can enter two letters for the eyes, with the first letter corresponding to the first eye, and the second letter being the second eye. This means the user can enter either 3 or 4 letters.
In the autotests you will be given the exact number of characters seen in the input. This means that if you get given afg, scanf("%c%c%c%c") will not work as there are only 3 characters given in the tests. This is to say there will be NO trailing newline character, '
', in the inputs (which is something you get when manually testing when you hit enter, but is not something that happens in the autotests).
Examples
dcc print_faces.c -o print_faces
./print_faces
How do you want to build a face?: afg
__
O O
~
\_/
./print_faces
How do you want to build a face?: ceh
\\
O O
^
/-\
./print_faces
How do you want to build a face?: cdei
\/
O O
^
o
./print_faces
How do you want to build a face?: abeg
_ ~
O O
^
\_/
./print_faces
How do you want to build a face?: dbfi
/ ~
O O
~
o
./print_faces
How do you want to build a face?: bbei
~ ~
O O
^
o
Assumptions/Restrictions/Clarifications
You should only use content taught in the course up to (and including) week 2.
You can assume you will only be given letters between 'a' and 'i' inclusive.
You can assume that the characters are given in the correct order (e.g. eyes then nose then mouth)
You can assume you will only be given 3 or 4 letters, no more, no less.
You can assume you will only get one letter corresponding to the nose, and one letter corresponding to the mouth.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions

Question

Identify and control your anxieties

Answered: 1 week ago

Question

Understanding and Addressing Anxiety

Answered: 1 week ago