Question: C programming. Primary Colour Mixer Objective: Develop a program that, when given two primary colours as input, returns the resulting mixture of the two colours.

C programming.
Primary Colour Mixer
Objective: Develop a program that, when given two primary colours as input, returns the resulting mixture of the two colours. The program should also identify and prompt if the user enters an invalid colour. Instructions:
1. The program should start by prompting the user: "First colour?"
2. After the user provides the first colour, prompt: "Second colour?"
3. Using the combination of user inputs, provide the resulting mixed colour. If the user enters the same colour twice, indicate that the result is the same as the input colour.
4. If an invalid colour is provided (i.e., it's not a primary colour), the user should be prompted again with the message: "[Colour] is not a valid primary colour!!!"
5. The valid primary colours and their mixtures are:
- Yellow + Red \(=\) Orange
- Red + Blue \(=\) Violet
- Blue + Yellow = Green
Coding Standards:
- Ensure usage of the strcmp function for string comparison.
- Use clear and descriptive variable names.
- Ensure proper indentation and include helpful comments throughout your code.
- Test your program extensively with various inputs to make sure your implementation matches the provided examples and handles edge cases.
For example: \begin{tabular}{l|l|l}
& Input & Expected \\
\hline & \begin{tabular}{l}
Red \\
Blue
\end{tabular} & \begin{tabular}{l}
First colour? \\
Second colour? \\
Red and Blue mix to make Violet
\end{tabular}\\
\hline \begin{tabular}{l}
Yellow \\
Black \\
Red
\end{tabular} & \begin{tabular}{l}
First colour? \\
Second colour? \\
Black is not a valid primary colour!!! \\
Second colour?
\end{tabular}\\
\hline
\end{tabular}
C programming. Primary Colour Mixer Objective:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!