Question: Execute the following code and identify the errors in the program. Debug the program and provide the correct version of the code. #include // employee

Execute the following code and identify the errors in the program. Debug the program and provide the correct version of the code.

#include

// employee structure definition

struct employee

{

unsigned int age;

char gender;

double hourlySalary;

struct employee e1;

};

int main(void)

{

// Store values in the e1

e1. age = 18;

e1. gender = F;

e1.hourlySalary = 11.50;

printf(%s%d , e1 age is:, e1.age);

printf(%s%c , e1 gender is:, e1.gender);

printf(%s%.2f , e1 hourly salary is:, e1.hourlySalary);

return 0;

Execute the following code and identify the errors in the program. Debug the program and provide the correct version of the code.

int main (void)

{

struct employee emp1; // define one struct employee variable

struct employee emp2;

// place strings into emp1

emp1.age = 20

emp1.hourlySalary = 25;

//emp2

emp2.age = 25

emp2.hourlySalary = 25;

if (emp1 > emp2)

{

printf( emp1 salary is greater than emp2 )

}

return 0;

}

Execute the following code and identify the errors in the program. Debug the program and provide the correct version of the code. Note: Be sure to check the output screen to see if the correct values are displaying according.

#include

// employee structure definition

struct employee

{

unsigned int age;

double hourlySalary;

};

#include

// number union definition

union number

{

int x;

double y;

};

int main (void)

{

union number value;

value.x = 100;

printf(x is %d , value.x);

printf(y is %.2f , value.y);

return 0;

}

Execute the following code and identify the errors in the program. Debug the program and provide the correct version of the code. Be sure the output looks exactly like the screen shot below.

#include

// days enumeration

enum days

{

MON = 0, TUE, WED, THU, FRI, SAT, SUN

}

int main(void)

{

Const char *dayName[] = { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };

for (enum days day = MON; day <= SUN; day++)

{

printf(%2d%11s , day, dayName[day]);

}

return 0;

}

Execute the following code and identify the errors in the program. Debug the program and provide the correct version of the code.

#include

// days enumeration

enum days

{

MON = 1, TUE, WED, THU, FRI, SAT, SUN

};

int main(void)

{

Const char *dayName[] = { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };

for (enum days day = MON; day <= SUN; day++)

{

printf(%2d%11s , day, dayName[day]);

}

return 0;

}

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!