The information about a date consists of the month the day a
The information about a date consists of the month, the day, and the year (all integer values) and is represented by the following structure type Date. Struct Date {int month; int day; int year;}; The information about a student consists of his ID number (an integer value), dale of birth (a Date structure type), and his GPA (a floating point value). Define a structure type StuInfo to represent this information. Write a statement to declare (define) the Structure variable StuInfo and to initialize its member variables as follows: ID number: 112 666 Date of birth: 2/25/1975 GPA: 3.25 Write a statement to declare (defuse) the structure variable student of the structure type StuInfo and to read the values for its member variables. Write another condition that can be used to replace each of the following the conditions: num _____ !num _____ Assuming that the variables are defined and initialized as follows: int num1 = 5, num2 = 2, num3 = 7; float fnum = 10.50; char ch = \'P\';
Solution
4)
a) struct StuInfo
{
int ID;
struct date DOB;
float GPA;
}
4) b)
struct StuInfo student={112666,{2,25,1975},3.25};
4) c)
struct StuInfo student;
student->ID=112666;
student->GPA=3.25;
student->(DOB->date)=25
student->(DOB->month)=2
student->(DOB->year)=1975
5)
!(!num)
!(num)
