Sample solution struct UserInfo { string uName, uContact; }; |
Sample solution void fillUser(UserInfo &user) { cout << "Please enter the name (one word): "; cin >> user.uName; cout << "Please enter the contact data (one word): "; cin >> user.uContact; } |
Sample solution void prtUser(UserInfo user) { cout << "User name: " << user.uName; cout << ", contact: " << user.uContact; } |
struct StoredData { string name; float result; }; // fills the name and result fields of each of the first N elements of the array void fillAll(StoredData arr[], int N);
Sample solution void fillAll(StoredData arr[], int N) { for (int s = 0; s < N; s++) { arr[s].name = getText(); arr[s].result = getNumber(); } } |