

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Electrical and Computer Engineering
1 of 17
Electrical and Computer Engineering
2 of 17
type (struct).
of the record (member), and each field is
given a name called the field (member)
name.
Electrical and Computer Engineering
3 of 17
Electrical and Computer Engineering
4 of 17
enum GradeType (A, B, C, D, F); struct StudentRec { string firstName; string lastName; float gpa; int programGrade; int quizGrade; int finalExam; GradeType courseGrade; };
StudentRec firstStudent; StudentRec student; int grade;
Electrical and Computer Engineering 5 of 17
Electrical and Computer Engineering 6 of 17
Electrical and Computer Engineering
7 of 17
Electrical and Computer Engineering
8 of 17
Electrical and Computer Engineering
9 of 17
#include
struct player { int assists; int points; int rebounds; };
int triple_double (struct player);
int main() { player shaq, the_admiral, kobe, jason; int shaq_td, jason_td; Electrical and Computer Engineering
10 of 17
shaq.assists = 2; shaq.points = 42; shaq.rebounds = 18;
jason. assists = 12; jason.points = 23; jason.rebounds = 10;
shaq_td = triple_double(shaq); cout << "shaq's triple double is " << shaq_td << endl; jason_td = triple_double(jason); cout << "jason's triple double is " << jason_td << endl; }
Electrical and Computer Engineering 11 of 17
int triple_double (struct player player_name) { int result;
if (player_name.assists >= 10 && player_name.points >= 10 && player_name.rebounds >= 10) result = 1; else result = 0; return result; }
Electrical and Computer Engineering 12 of 17
records are called hierarchical records.