Question: fix errors displayed in build messages code #include #include #include int main(void) { int choice; //offer the user a choice of entering numbers to choose

fix errors displayed in build messages code #include #include #include int main(void)fix errors displayed in build messages code

#include #include #include

int main(void) { int choice; //offer the user a choice of entering numbers to choose a question printf("Please select one of the following (1,2,3 or 4): ");

printf("1. I would like to know my weight on other planets. "); printf("2. I would like to convert time to seconds. "); printf("3. I would like to know how many seconds it takes a planet to orbit the sun. "); printf("4. I would like to exit. ");

//read in users choice scanf("%d", &choice);

// test users choice (switch) switch(choice) { case 1: { float objectWeight; //declare the variable for the object's weight int planet; //declare the variable for the planet number int i;

const char* planetNames[] = { "Mercury", "Venus", "Earth", "Earth's Moon", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto" }; const double planetRatios[] = { 0.4155, 0.8975, 1.0, 0.166, 0.3507, 2.5374, 1.0677, 0.8947, 1.1794, 0.0899 };

printf("Enter an object's weight in pounds. "); scanf("%f", &objectWeight); //read the value from the end user

//Print the below menu to the screen printf(" " "Please choose from the following menu one of the bodies found in our solar " "system by entering it's corresponding number. ");

// Print all available planets for (i = 0; i

scanf("%d", &planet); //read the planet number from the user printf(" ");

if (planet > 0 && planet

return 0; } break; case 2: //function to convert to seconds int d,h,s; printf("Enter number of days (space) hours (space) seconds:"); scanf("%d %d %d",&d,&h,&s); printf("Entered time in seconds:%ld ",toseconds(d,h,s)); return (d*24*60*60 + h*60*60 + s);

break; case 3: float calculate(float PlanetTime[],int id); { return (PlanetTime[id]*24*60*60); //The Return should not be of float type } int main() { float PlanetTime[]={87.97,224.70,365.26,686.93,4332.82,10755.70,30687.15,60190.03}; const char *PlanetNames[]={"Mercury","venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune"}; char planet[20]; //planet name should be a character array int id=0; printf("Which planet do you choose ?"); gets(planet); //input is taken using gets method int i; for(i=0;i final nour and beccac-Code:Blocks 16.01 File Edit View Search Project Build Debug Fortran wSmithTools Tools+ Plugins DoxyBlocks Settings Help gobal> main(void): int DOD Start here Xfinal nour and becca.c X Projects Symbols Files Workspace 60 61 break case 2: /tunction to convert to seconds int d,h,s: printf("Enter number of days (space) hours (space) seconds:" scant( "%d %d ", sd, sh,ss) ; printf ( "Entered time in seconds hgln", toseconds (d, h, 8) ) ; retun (d*24*60 60 +h*60 60 + s 63 65 67 68 69 70 71 72 73 74 75 76 break float calculate (float PlanetTime rint id) return (PlanetTime [id] *24 60 60)//The Return should not be or zloat type int main() float PlanetTime [ ] = { 87, 97, 224 . 70, 365. 26, 686. 93, 4332. 82, 10755. 70, 30687, 15, 60|90. 03} ; 78 79 Logs & others Build messages X ACppCheck CppCheck messages X Cscope Debugger DoxyBod s Fortran info laosed files lst X , Thread sear File C : \Users\Nour\ . . . C:UsersNour C:Userour C:\Users Nour\... C:Userour Line Message E4 73 error: a label ean only be part of a statement and dee1 aration is not a statement error: a label can only be par of a atement and a declaration is not a statement error: 'PlanetTime" undeclared [first use in this function] note: each undeclared identifier is reported only once for each function it appears in 78 in this function) Windows (CR+LF) WINDOWS-1252 Line 64, Column 1 Insert Read/Write default 10:36 PM O Type here to search

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!