Sample solution struct StudentData { long sID, sGPA; }; |
Sample solution void fillStudent(StudentData &st) { cout << "Please enter the student id as an integer (e.g. 123456): "; cin >> st.sID; cout << "Please enter the student gpa as an integer (e.g. 3): "; cin >> st.sGPA; } |
Sample solution void printStudent(StudentData st) { cout << "ID: " << st.sID << ", gpa: " << st.sGPA; } |
struct Info { string word; float data; }; // fills the word and data fields of each element in the array void fillAllInfo(Info dataArr[], int size);
Sample solution void fillAllInfo(Info dataArr[], int size) { for (int i = 0; i < size; i++) { dataArr[i].word = getWord(); dataArr[i].data = getFloat(); } } |