!!!!!!!!!!CAN SOMEONE PLEASE CONVERT THIS INTO PSEUDOCODE!!!!!!!! Im having difi
ID: 3688891 • Letter: #
Question
!!!!!!!!!!CAN SOMEONE PLEASE CONVERT THIS INTO PSEUDOCODE!!!!!!!! Im having dificulty going back and forth from C++
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
bool flag1, flag2;
string color1, color2, color3;
cout<<"Enter two primary colors to mix: ";
cin>>color1; //Read color1
cin>>color2; //Read color2
color3 = "fail"; //color3 initialized to fail
flag1 = color1.compare("red"); //color1 is red or not.
flag2 = color2.compare("blue"); //color2 is blue or not.
if(flag1 == 0 && flag2 == 0) //If color1 is red and color2 is blue
color3 = "purple"; //Secondary color is purple.
flag1 = color1.compare("blue"); //color1 is blue or not.
flag2 = color2.compare("red"); //color2 is red or not.
if(flag1 == 0 && flag2 == 0) //If color1 is blue and color2 is red
color3 = "purple"; //Secondary color is purple.
flag1 = color1.compare("red");
flag2 = color2.compare("yellow");
if(flag1 == 0 && flag2 == 0)
color3 = "orange";
flag1 = color1.compare("yellow");
flag2 = color2.compare("red");
if(flag1 == 0 && flag2 == 0)
color3 = "orange";
flag1 = color1.compare("blue");
flag2 = color2.compare("yellow");
if(flag1 == 0 && flag2 == 0)
color3 = "green";
flag1 = color1.compare("yellow");
flag2 = color2.compare("blue");
if(flag1 == 0 && flag2 == 0)
color3 = "green";
if(!color3.compare("fail")) //If any of the conditions did not satisfy.
cout<<"Invalid Primary Color. The primary colors are only RED, BLUE, and YELLOW."<<endl; //Print ERROR message.
else
cout<<"The name of the secondary color after mixing "<<color1<<" and "<<color2<<" is: "<<color3<<endl; //Print the secondary color.
}
Explanation / Answer
Answer
PRIMARY(flag1, flag2, color1, color2, color3)
{
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.