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 06:00
Write a function that draws a pool ball. this function should take as parameters, the color, the number that should go on the pool ball, and the location of the center of the pool ball. the radius of the pool balls should be pool_ball_radius, and the font of the number should be pool_ball_font. the text of the pool ball font should be white. drawpoolball(color.orange, 5, 100, 100); drawpoolball(color.green, 6, 50, 200); drawpoolball(color.red, 3, 150, 350); drawpoolball(color.blue, 2, 250, 140); to center the numbers on the pool ball, you should use the getwidth() and getheight() methods. you are allowed to call these methods on your text object, such as txt.
Answers: 3
question
Computers and Technology, 22.06.2019 09:00
What is one way in which tablets differ from laptops and notebooks? tablets are designed for touch-based interaction. tablets are designed to be used as desktops. tablets are designed for input via a keyboard and mouse. tablets are designed to be larger than laptops.
Answers: 1
question
Computers and Technology, 22.06.2019 10:40
When running anti-virus software , what could be a reason where recipitent is not guaranteed that data being streamed will not get interrupted?
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
You know the right answer?
C Programming

*Notice: I can only edit the part where it says in /* Your solution goes...
Questions
question
Social Studies, 21.03.2020 00:16
question
Mathematics, 21.03.2020 00:17