Question
My code is c++ programming can you guys help me and fix my mistake? here is my code #include #include #include #include using namespace std;
My code is c++ programming
can you guys help me and fix my mistake?
here is my code
#include
using namespace std;
int main(){
// Add constants // Constant for R_SEED const int R_SEED = 314159; // Constant for maximum and minimum values for random number generation const int MAX = 12, MIN = -12; //Constant for radius of the circle const int R = 10; //Constant for epsilon const double EPSILON = 0.0001;
// Declare two variable for user input char choice; double x, y;
//configure RNG with R_SEED srand(R_SEED);
//prompt user with selection choice cout
//read user choice cin >> &choice;
//convert lower case choice to upper case choice choice = toupper(choice);
//switch statement for setting x and y values switch(choice){ case 'E': // Take user input for x and y coordinate cout > x;
cout > y;
break; case 'R': //generate random value between -12 to 12 for x and y coordinate x = MIN + ((double)rand() / RAND_MAX) * (MAX-MIN); y = MIN + ((double)rand() / RAND_MAX) * (MAX-MIN); break; default: cout
//set precision for print double values std::cout
// Compute particle distance from origin double distance = sqrt(x*x + y*y);
//Declare and assign boolean onWall variable bool onWall = false; if(abs(R - distance)
//Declare and assign boolean inside variable bool inside = false; if(R > distance + EPSILON || R > distance - EPSILON) inside = true;
// Using flags show output if(onWall) cout
}
3: Random upper ^ Output differs. See highlights below. Input R Your output Select particle location by: [E] entering coordinates (R) random generation Particle is at (-7.36, 10.46) Outside cell wall Expected output Select particle location by: [E] entering coordinates [R] random generation Particle is at (-7.00, -5.00) Inside cell wall 4: Random lower A Output differs. See highlights below. Input Your output Select particle location by: [E] entering coordinates (R) random generation Particle is at (-7.36, 10.46) Outside cell wall Expected output Select particle location by: [E] entering coordinates (R) random generation Particle is at (-7.00,-5.00) Inside cell wallStep 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