Question
#include #include int main() { int ans[14],sum=0;//array to store the responses and sum to keep count of them char str1[5];//input string char str[14][11]={Red,Blue,Black,Brown,White,Pink,Purple,Gray, Yellow,Baby Blue,Green,Baby
#include
#include
int main()
{
int ans[14],sum=0;//array to store the responses and sum to keep count of them
char str1[5];//input string
char str[14][11]={"Red","Blue","Black","Brown","White","Pink","Purple","Gray",
"Yellow","Baby Blue","Green","Baby Pink","Violet","Orange"};//2D array that maps value with colour
for(int i=0;i<14;i++){//loop to iterate all the colors
printf("%d.Do you love %s colors ",i+1,str[i]);
x:
scanf("%s",str1);//taking input
if(strcmp(str1,"yes")==0)//comparing the input string
ans[i] = 1;
else if(strcmp(str1,"no")==0)
ans[i] = 0;
else{
printf("Please enter \"yes\" or \"no\" only ");
goto x;//In case any wrong input is given
}
sum+=ans[i];
}
printf(" ");
if(sum==2){//To find if there are only 2 loved colours
for(int i=0;i<14;i++)//Loop to check the loved colours
if(ans[i])
printf("%d",i+1);
}
else
printf("only two colors are not loved ");
return 0;
}
(Can you please update this C programing by using structure, array or multidimensional array only, but please do not change the idea or informations. In addition, please I need the output to be words not numbers for example (red and blue). And also the program must include structure.)
(Please answer in(C) not c++ or java )
Q1/ do you love red colors? 2/blue? 3/black? 4/brown? 5/white? 6/pink? 7/purple? 8/gray? 9/yellow? 10/baby blue? 11/green? 12/baby pink? 13/violet? 14/orange?
(You have to answer each one in a new line; the answer should be yes or no)
If your answer is yes for 1 and the other no print red1
If your answer for 1 and 2 is yes and the other no print red and blue1
If your answer for 1 and 3 is yes and the other no print red and black1
If your answer for 1 and 4 is yes and the other no print red and brown1
If your answer for 1 and 5 is yes and the other no print red and white1
If your answer for 1 and 6 is yes and the other no print red and pink1
If your answer for 1 and 7 is yes and the other no print red and purple1
If your answer for 1 and 8 is yes and the other no print red and gray1
If your answer for 1 and 9 is yes and the other no print red and yellow1
If your answer for 1 and 10 is yes and the other no print red and baby blue1
If your answer for 1 and 11 is yes and the other no print red and green1
If your answer for 1 and 12 is yes and the other no print red and baby pink1
If your answer for 1 and 13 is yes and the other no print red and violet1
If your answer for 1 and 14 is yes and the other no print red and orange1
If your answer is yes for 2 and the other no print blue1
If your answer for 2 and 3 is yes and the other no print blue and black1
If your answer for 2 and 4 is yes and the other no print blue and brown1
If your answer for 2 and 5 is yes and the other no print blue and white1
If your answer for 2 and 6 is yes and the other no print blue and pink1
If your answer for 2 and 7 is yes and the other no print blue and purple1
If your answer for 2 and 8 is yes and the other no print blue and gray1
If your answer for 2 and 9 is yes and the other no print blue and yellow1
If your answer for 2 and 10 is yes and the other no print blue and baby blue1
If your answer for 2 and 11 is yes and the other no print blue and green1
If your answer for 2 and 12 is yes and the other no print blue and baby pink1
If your answer for 2 and 13 is yes and the other no print blue and violet1
If your answer for 2 and 14 is yes and the other no print blue and orange1
If your answer is yes for 3 and the other no print black1
If your answer for 3 and 4 is yes and the other no print black and brown1
If your answer for 3 and 5 is yes and the other no print black and white1
If your answer for 3 and 6 is yes and the other no print black and pink1
If your answer for 3 and 7 is yes and the other no print black and purple1
If your answer for 3 and 8 is yes and the other no print black and gray1
If your answer for 3 and 9 is yes and the other no print black and yellow1
If your answer for 3 and 10 is yes and the other no print black and baby blue1
If your answer for 3 and 11 is yes and the other no print black and green1
If your answer for 3 and 12 is yes and the other no print black and baby pink1
If your answer for 3 and 13 is yes and the other no print black and violet1
If your answer for 3 and 14 is yes and the other no print black and orange1
If your answer is yes for 4 and the other no print brown1
If your answer for 4 and 5 is yes and the other no print brown and white1
If your answer for 4 and 6 is yes and the other no print brown and pink1
If your answer for 4 and 7 is yes and the other no print brown and purple1
If your answer for 4 and 8 is yes and the other no print brown and gray1
If your answer for 4 and 9 is yes and the other no print brown and yellow1
If your answer for 4 and 10 is yes and the other no print brown and baby blue1
If your answer for 4 and 11 is yes and the other no print brown and green1
If your answer for 4 and 12 is yes and the other no print brown and baby pink1
If your answer for 4 and 13 is yes and the other no print brown and violet1
If your answer for 4 and 14 is yes and the other no print brown and orange1
If your answer is yes for 5 and the other no print white 1
If your answer for 5 and 6 is yes and the other no print white and pink1
If your answer for 5 and 7 is yes and the other no print white and purple1
If your answer for 5 and 8 is yes and the other no print white and gray1
If your answer for 5 and 9 is yes and the other no print white and yellow1
If your answer for 5 and 10 is yes and the other no print white and baby blue1
If your answer for 5 and 11 is yes and the other no print white and green1
If your answer for 5 and 12 is yes and the other no print white and baby pink1
If your answer for 5 and 13 is yes and the other no print white and violet1
If your answer for 5 and 14 is yes and the other no print white and orange1
If your answer is yes for 6 and the other no print pink1
If your answer for 6 and 7 is yes and the other no print pink and purple1
If your answer for 6 and 8 is yes and the other no print pink and gray11
If your answer for 6 and 9 is yes and the other no print pink and yellow1
If your answer for 6 and 10 is yes and the other no print pink and baby blue11
If your answer for 6 and 11 is yes and the other no print pink and green11
If your answer for 1 and 12 is yes and the other no print pink and baby pink1
If your answer for 6 and 13 is yes and the other no print pink and violet22
If your answer for 6 and 14 is yes and the other no print pink and orange2
If your answer is yes for 7 and the other no print purple2
If your answer for 7 and 8 is yes and the other no print purple and gray22
If your answer for 7 and 9 is yes and the other no print purple and yellow2
If your answer for 7 and 10 is yes and the other no print purple and baby blue2
If your answer for 7 and 11 is yes and the other no print purple and green2
If your answer for 7 and 12 is yes and the other no print purple and baby pink2
If your answer for 7 and 13 is yes and the other no print purple and violet4
If your answer for 7 and 14 is yes and the other no print purple and orange44
If your answer is yes for 8 and the other no print gray4
If your answer for 8 and 9 is yes and the other no print gray and yellow3
If your answer for 8 and 10 is yes and the other no print gray and baby blue33
If your answer for 8 and 11 is yes and the other no print gray and green3
If your answer for 8 and 12 is yes and the other no print gray and baby pink3
If your answer for 8 and 13 is yes and the other no print gray and violet33
If your answer for 8 and 14 is yes and the other no print gray and orange3
If your answer is yes for 9 and the other no print yellow3
If your answer for 9 and 10 is yes and the other no print yellow and baby blue66
If your answer for 9 and 11 is yes and the other no print yellow and green6
If your answer for 9 and 12 is yes and the other no print yellow and baby pink6
If your answer for 9 and 13 is yes and the other no print yellow and violet6
If your answer for 9 and 14 is yes and the other no print yellow and orange66
If your answer is yes for 10 and the other no print baby blue6
If your answer for 10 and 11 is yes and the other no print baby blue and green4
If your answer for 10 and 12 is yes and the other no print baby blue and baby pink4
If your answer for 10 and 13 is yes and the other no print baby blue and violet44
If your answer for 10 and 14 is yes and the other no print baby blue and orange
If your answer is yes for 11 and the other no print green
If your answer for 11 and 12 is yes and the other no print green and baby pink
If your answer for 11 and 13 is yes and the other no print green and violet
If your answer for 11 and 14 is yes and the other no print green and orange
If your answer is yes for 12 and the other no print baby pink
If your answer for 12 and 13 is yes and the other no print baby pink and violet
If your answer for 12 and 14 is yes and the other no print baby pink and orange
If your answer is yes for 13 and the other no print violet
If your answer for 13 and 14 is yes and the other no print violet and orange
If your answer is yes for 14 and the other no print orange
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started