Question
#include #include using namespace std; int main() { double mass, weightEarth, weightMoon, weightMars; //Declare variables for earth,moon and mars const double earth = 9.81; const
#include
#include
using namespace std;
int main() {
double mass, weightEarth, weightMoon, weightMars;
//Declare variables for earth,moon and mars
const double earth = 9.81;
const double moon = 1.62;
const double mars = 3.77;
cout
cout
cin >> mass;
if (mass
cout
else
{
weightEarth = mass * earth;
weightMoon = mass * moon;
weightMars = mass * mars;
//formatting using setw ,left and right
cout
cout
cout
cout
if (weightEarth
cout
else if (weightEarth >= 1000)
cout
}
return 0;
} //End function main
Above is the expected output if the input is 1. Being confusing for the errors.
packages. C4700 uninitialized local variable 'mass' used lesson4part1 lesson4part1.cpp 21 troStep 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