subject

C Programming

*Notice: I can only edit the part where it says in /* Your solution goes here */ the other part of the code i can't touch it please the solution should be inside that part ad using the code provided

Question 1

Define a function SetBirth, with int parameters monthVal and dayVal, that returns a struct of type BirthMonthDay. The function should assign BirthMonthDay's data member month with monthVal and day with dayVal.

#include

typedef struct BirthMonthDay_struct {
int month;
int day;
} BirthMonthDay;

/* Your solution goes here */

int main(void) {
BirthMonthDay studentBirthday;
int month;
int day;

scanf("%d %d", &month, &day);
studentBirthday = SetBirth(month, day);
printf("The student was born on %d/%d.\n", studentBirthday. month, studentBirthday. day);

return 0;
}

Question2

Assign Carbonara's data member caloriesPerSlice with 350 and Four Cheese's with 280.

#include
#include

typedef struct PizzaInfo_struct {
char pizzaName[30];
int caloriesPerSlice;
} PizzaInfo;

int main(void) {

PizzaInfo availablePizzas[2];

strcpy(availablePizzas[0].pizzaName , "Carbonara");
strcpy(availablePizzas[1].pizzaName , "Four Cheese");

/* Your solution goes here */

printf("A %s pizza contains %d calories\n", availablePizzas[0].pizzaName, availablePizzas[0].caloriesPerSlice );
printf("A %s pizza contains %d calories\n", availablePizzas[1].pizzaName, availablePizzas[1].caloriesPerSlice );

return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:00
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
question
Computers and Technology, 23.06.2019 20:10
Leo is a recruitment executive for a large company. he has identified new labor resource requirements in both the marketing and production departments. what should be his first step in recruiting candidates for the positions? a. conduct background checks of candidates b. make job offers c. arrange interviews d. conduct reference checks e. place job ads on job sites
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Under the home tab, where can a user find options to change the bullet style of an outline? in the slides group in the font group in the paragraph group in the drawing group
Answers: 1
You know the right answer?
C Programming

*Notice: I can only edit the part where it says in /* Your solution goes...
Questions
question
English, 03.08.2019 00:00
question
English, 03.08.2019 00:00
question
Mathematics, 03.08.2019 00:00
Questions on the website: 13722363