I'm trying to create a print void function, however I'm not understanding how to call the database in the print function. I've tried to do something similar to what is in my textbook but all I'm getting is errors. This is what I've done so far.
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
struct Student
{
string name;
string address;
string city;
string state;
int zip;
char gender;
string id;
float gpa;
} a, b, c;
void printstudent(Student& a)
{
cout << name << endl;
cout << address << endl;
}
int main()
{
// student 1 user input info
cout << "What is Student 1's name?: ";
getline(cin,a.name);
cout << "What is Student 1's address?: ";
getline(cin,a.address);
cout << "What is Student 1's city?: ";
getline(cin,a.city);
cout << "What is Student 1's state?: ";
getline(cin,a.state);
cout << "What is Student 1's student ID?: ";
getline(cin,a.id);
cout << "What is Student 1's zip?: ";
cin >> a.zip;
cout << "What is Student 1's gender?[M/F]: ";
cin >> a.gender;
cout << "What is Student 1's gpa?: ";
cin >> a.gpa;
printstudent(Student& a);
return 0;
}