Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with the program, could you please help? Write a C++ program that as

ID: 3763963 • Letter: I

Question

I need help with the program, could you please help?

Write a C++ program that askes the user for their weight and the name of a planet. Write the program so that it uses an enumerated type to represent the planet. The following table gives the factor by which the weight must be multiplied for each planet. The program should output an error message if the user doesn't input a correct planet name. The prompt and trhe error message should make it clear to the user how a planet name must be entered. Be sure to use proper formatting and appropriate comments in your code. The output should be labled clearly and formatted neatly.

Mercury 0.4155

Venus 08975

Earth 1.0

Moon 0.166

Mars 0.3507

Jupiter 1.5374

Saturn 1.0677

Uranus 0.8947

Neptune 1.1794

Pluto 0.0899

Explanation / Answer

#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
   struct planet
   {
       char name[10];
       double w;
   };
   int i;
   char na[10];
   struct planet o[10];

   for(i=0;i<10;i++)
   {
       cout<<"Enter Planet Name";
       cin>>o[i].name;

       cout<<"Enter Planet Weight";
       cin>>o[i].w;
   }

   cout<<"Enter Planet Name to get Weight";
   cin>>na;

   for(i=0;i<10;i++)
   {
       if(strcmp(na,o[i].name)==0)
       {
           cout<<o[i].w;
           break;
       }
   }
   getch();

}