Student Data Score First Name Last Name ID
![Student Data Score First Name Last Name ID GPA DOB Phone. . . How Student Data Score First Name Last Name ID GPA DOB Phone. . . How](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-1.jpg)
![Store Student Data in Variables // For one student at a time float score, Store Student Data in Variables // For one student at a time float score,](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-2.jpg)
![Store Students Data in Parallel Arrays const int MAX_SIZE = 30; // To keep Store Students Data in Parallel Arrays const int MAX_SIZE = 30; // To keep](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-3.jpg)
![C++ Structure struct Student { string id; string first. Name, last. Name; float gpa; C++ Structure struct Student { string id; string first. Name, last. Name; float gpa;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-4.jpg)
![Structure Variables int num. Students; float score; Student s 1, s 2; // Student Structure Variables int num. Students; float score; Student s 1, s 2; // Student](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-5.jpg)
![Accessing Members of a Structure Variable Student s 1; // Input data into struct Accessing Members of a Structure Variable Student s 1; // Input data into struct](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-6.jpg)
![C++ Class class Student { string id; string first. Name, last. Name; float gpa; C++ Class class Student { string id; string first. Name, last. Name; float gpa;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-7.jpg)
![C++ Class class Student { private: string id; string first. Name, last. Name; float C++ Class class Student { private: string id; string first. Name, last. Name; float](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-8.jpg)
![Class Methods class Student { private: string id; string first. Name, last. Name; float Class Methods class Student { private: string id; string first. Name, last. Name; float](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-9.jpg)
![Class Methods class Student { private: string id; string first. Name, last. Name; float Class Methods class Student { private: string id; string first. Name, last. Name; float](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-10.jpg)
![Calling Class Methods Student s 1; // Input data into object s 1. Read(); Calling Class Methods Student s 1; // Input data into object s 1. Read();](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-11.jpg)
![Syntax and Style class Student { private: string id; string first. Name, last. Name; Syntax and Style class Student { private: string id; string first. Name, last. Name;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-12.jpg)
![Semantics class Student { private: string id; string first. Name, last. Name; float gpa; Semantics class Student { private: string id; string first. Name, last. Name; float gpa;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-13.jpg)
![Semantics class Student { private: string id; string first. Name, last. Name; float gpa; Semantics class Student { private: string id; string first. Name, last. Name; float gpa;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-14.jpg)
![C++ Classes cin >> base; while ( !cin. eof() && (base < 2 || C++ Classes cin >> base; while ( !cin. eof() && (base < 2 ||](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-15.jpg)
![More Class Methods class Student { private: . . . public: . . . More Class Methods class Student { private: . . . public: . . .](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-16.jpg)
![More Class Methods class Student { private: . . . public: . . . More Class Methods class Student { private: . . . public: . . .](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-17.jpg)
![Calling Class Methods // Comparing two students if ( s 1. get. GPA() > Calling Class Methods // Comparing two students if ( s 1. get. GPA() >](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-18.jpg)
![Calling Class Methods // Updating students data s 1. set. GPA( 2. 9 ); Calling Class Methods // Updating students data s 1. set. GPA( 2. 9 );](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-19.jpg)
![class Student {. . . } int main() { Student s 1, s 2; class Student {. . . } int main() { Student s 1, s 2;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-20.jpg)
![//--------------------// Comment Block //--------------------// Includes // constants class Student {. . . } // //--------------------// Comment Block //--------------------// Includes // constants class Student {. . . } //](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-21.jpg)
![Schedule • Quiz 5 -5: Due today • Quiz 7 -1: Due Wednesday • Schedule • Quiz 5 -5: Due today • Quiz 7 -1: Due Wednesday •](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-22.jpg)
![Quiz 5 -6 Now 24 Quiz 5 -6 Now 24](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-23.jpg)
- Slides: 23
![Student Data Score First Name Last Name ID GPA DOB Phone How Student Data Score First Name Last Name ID GPA DOB Phone. . . How](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-1.jpg)
Student Data Score First Name Last Name ID GPA DOB Phone. . . How to store student data in our programs? 1
![Store Student Data in Variables For one student at a time float score Store Student Data in Variables // For one student at a time float score,](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-2.jpg)
Store Student Data in Variables // For one student at a time float score, GPA; string first. Name, last. Name, ID; … 2
![Store Students Data in Parallel Arrays const int MAXSIZE 30 To keep Store Students Data in Parallel Arrays const int MAX_SIZE = 30; // To keep](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-3.jpg)
Store Students Data in Parallel Arrays const int MAX_SIZE = 30; // To keep data for all students float scores[MAX_SIZE], GPA[MAX_SIZE]; string first. Name[MAX_SIZE], last. Name[MAX_SIZE], ID[MAX_SIZE]; 3
![C Structure struct Student string id string first Name last Name float gpa C++ Structure struct Student { string id; string first. Name, last. Name; float gpa;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-4.jpg)
C++ Structure struct Student { string id; string first. Name, last. Name; float gpa; }; // Student is a data type! 4
![Structure Variables int num Students float score Student s 1 s 2 Student Structure Variables int num. Students; float score; Student s 1, s 2; // Student](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-5.jpg)
Structure Variables int num. Students; float score; Student s 1, s 2; // Student is a data type! 5
![Accessing Members of a Structure Variable Student s 1 Input data into struct Accessing Members of a Structure Variable Student s 1; // Input data into struct](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-6.jpg)
Accessing Members of a Structure Variable Student s 1; // Input data into struct cout << "Enter ID: "; cin >> s 1. id; cout << "Enter first name: "; cin >> s 1. first. Name; // Output student data cout << setw(9) << s 1. id << setw(25) << s 1. first. Name; Using the dot notation! 6
![C Class class Student string id string first Name last Name float gpa C++ Class class Student { string id; string first. Name, last. Name; float gpa;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-7.jpg)
C++ Class class Student { string id; string first. Name, last. Name; float gpa; }; // Student is a class (data type)! // By default, all fields are private. 7
![C Class class Student private string id string first Name last Name float C++ Class class Student { private: string id; string first. Name, last. Name; float](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-8.jpg)
C++ Class class Student { private: string id; string first. Name, last. Name; float gpa; public: . . . }; Create public functions (methods) to access private fields. 8
![Class Methods class Student private string id string first Name last Name float Class Methods class Student { private: string id; string first. Name, last. Name; float](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-9.jpg)
Class Methods class Student { private: string id; string first. Name, last. Name; float gpa; public: // Make sure the order is correct. void Read() { cin >> id >> first. Name >> last. Name >> gpa; } }; 9
![Class Methods class Student private string id string first Name last Name float Class Methods class Student { private: string id; string first. Name, last. Name; float](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-10.jpg)
Class Methods class Student { private: string id; string first. Name, last. Name; float gpa; public: void Read() void Print() { cout << endl; cout << setw(9) << id << setw(20) << first. Name << setw(20) << last. Name << setw(5) << gpa; } }; 10
![Calling Class Methods Student s 1 Input data into object s 1 Read Calling Class Methods Student s 1; // Input data into object s 1. Read();](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-11.jpg)
Calling Class Methods Student s 1; // Input data into object s 1. Read(); // Output data of object s 1. Print(); Using the dot notation! 11
![Syntax and Style class Student private string id string first Name last Name Syntax and Style class Student { private: string id; string first. Name, last. Name;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-12.jpg)
Syntax and Style class Student { private: string id; string first. Name, last. Name; float gpa; public: void Read(). . . }; // class, private, public: key word // Student: Identifier, your choice // Fields : Declaring variables // Braces // Semicolon after } // Read, Print: class methods (function inside class) // Indentation 12
![Semantics class Student private string id string first Name last Name float gpa Semantics class Student { private: string id; string first. Name, last. Name; float gpa;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-13.jpg)
Semantics class Student { private: string id; string first. Name, last. Name; float gpa; public: void Read() { cin >> id >> first. Name >> last. Name >> gpa; }. . . }; Student is a new data type! It has data fields and methods (functions) on the data. 13
![Semantics class Student private string id string first Name last Name float gpa Semantics class Student { private: string id; string first. Name, last. Name; float gpa;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-14.jpg)
Semantics class Student { private: string id; string first. Name, last. Name; float gpa; public: void Read() { cin >> id >> first. Name >> last. Name >> gpa; }. . . }; Data fields have class scope and can be accessed from any class methods! 14
![C Classes cin base while cin eof base 2 C++ Classes cin >> base; while ( !cin. eof() && (base < 2 ||](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-15.jpg)
C++ Classes cin >> base; while ( !cin. eof() && (base < 2 || base > 9) ) { // display message cin. ignore(MAX_LINE_SIZE, ‘n’); cin >> base: } 15
![More Class Methods class Student private public More Class Methods class Student { private: . . . public: . . .](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-16.jpg)
More Class Methods class Student { private: . . . public: . . . string get. First() { return first. Name; } void set. First. Name( string name ) { first. Name = name; } }; 16
![More Class Methods class Student private public More Class Methods class Student { private: . . . public: . . .](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-17.jpg)
More Class Methods class Student { private: . . . public: . . . string get. GPA() { return gpa; } void set. GPA( float value ) { gpa = value; } void update. GPA( float amount ) { gpa += amount; } }; 17
![Calling Class Methods Comparing two students if s 1 get GPA Calling Class Methods // Comparing two students if ( s 1. get. GPA() >](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-18.jpg)
Calling Class Methods // Comparing two students if ( s 1. get. GPA() > s 2. get. GPA() ) cout << “n. First student has higher GPA. "; else if ( s 1. get. GPA() < s 2. get. GPA() ) cout << “n. Second student has higher GPA. "; else cout << “n. The two student have the same GPA. "; 19
![Calling Class Methods Updating students data s 1 set GPA 2 9 Calling Class Methods // Updating students data s 1. set. GPA( 2. 9 );](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-19.jpg)
Calling Class Methods // Updating students data s 1. set. GPA( 2. 9 ); s 1. update. GPA( 0. 5 ); if ( s 1. get. GPA() > s 2. get. GPA() ) cout << “n. First student has higher GPA. "; else if ( s 1. get. GPA() < s 2. get. GPA() ) cout << “n. Second student has higher GPA. "; else cout << “n. The two student have the same GPA. "; 20
![class Student int main Student s 1 s 2 class Student {. . . } int main() { Student s 1, s 2;](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-20.jpg)
class Student {. . . } int main() { Student s 1, s 2; s 1. Read(); s 2. Read(); s 1. Print(); s 2. Print(); // Comparing GPA of s 1 and s 2 s 1. update. GPA( 0. 5 ); // Comparing GPA of s 1 and s 2 return 0; } 21
![Comment Block Includes constants class Student //--------------------// Comment Block //--------------------// Includes // constants class Student {. . . } //](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-21.jpg)
//--------------------// Comment Block //--------------------// Includes // constants class Student {. . . } // Function prototypes int main() {. . . return 0; } // Function definitions 22
![Schedule Quiz 5 5 Due today Quiz 7 1 Due Wednesday Schedule • Quiz 5 -5: Due today • Quiz 7 -1: Due Wednesday •](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-22.jpg)
Schedule • Quiz 5 -5: Due today • Quiz 7 -1: Due Wednesday • Wednesday: Test 2 Review • Thursday: Lab 8 • Friday Test 2: 60 points Notes 11 - 22 • Program 4 Due Wednesday, April 6 Grace Friday, April 8 23
![Quiz 5 6 Now 24 Quiz 5 -6 Now 24](https://slidetodoc.com/presentation_image/1749c3d19d17b8fd1469b549b5444726/image-23.jpg)
Quiz 5 -6 Now 24
Authors by initials
First name last name tpu
Were you at the beach last weekend
What did they do last weekend
Class maths student student1 class student string name
Student's first name
Student id name department name
Iscd logo
T score and z score difference
Her name
List the steps in the paced decision-making process
Uheaa contact
National student clearinghouse student tracker
Student freckle. com
Teacher : good morning class
Student learning space student login
Name a line containing point a
First last
First last
First last
First.m.last format
Foil math
Ethernet preamble
Looking at student work protocol template