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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:30, gg68814
1.the index finger on your right hand types the f r v 4 j u m 7 h y 6 n lo.9 j u 7 m g t 5 b 2.if you need to multiply 400, 2, and 1 ½, what would you type on the numeric keypad? 400*2*1.5 400/2*1.5 400/2/1.5 400*2*1½ 3.select all examples of proper keyboarding technique. rest your fingers gently on the home row or home keys. slouch in your chair. rest your palms on the keyboard. relax your fingers. keep your hands lower than your elbows.
Answers: 1
image
Computers and Technology, 23.06.2019 05:30, savyblue1724707
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, muncyemily
From excel to powerpoint, you can copy and paste a. cell ranges and charts, one at a time. b. cell ranges and charts, simultaneously. c. charts only. d. cell ranges only.
Answers: 3
image
Computers and Technology, 24.06.2019 08:20, brinks7994
Which type of entity describes a fundamental business aspect of a database? a. linking b. lookup c. domain d. weak
Answers: 3
You know the right answer?
C Programming

*Notice: I can only edit the part where it says in /* Your solution goes...

Questions in other subjects:

Konu
Mathematics, 24.03.2020 03:18
Konu
Mathematics, 24.03.2020 03:18