error in calling a function

hello my program showing an error my printStudent(alpha); is not calling the
function to print out the information.
Can some help thanks



//write a program that create struct of 4 members
//and declare array of 20 struct objects

#include <iostream>
#include <sstream>
#include <cstdlib>
#include <string>
#include <iomanip>

using namespace std;

const int amt = 20;
struct student
{
string firstName;
string lastName;
string add;
int id;
};
struct classRecord
{
string courseName;
string teacher;
string school;
int numMale;
int numFemale;
student myStudent[20];

classRecord() // my default constructor
{
courseName = "CPTR 151";
teacher = "Mr. Hunte";
school = "USC";
numMale = 10;
numFemale = 1;
}
void printStudent(student classA[])
{
int x;
for(x = 0; x < 20; x++)
{
cout<<myStudent[x].firstName<<myStudent[x].lastName<<myStudent[x].add<<myStudent[x].id;
}//end for
}// end void
};
//declare variable
student mystudent[20] ={""};

//declare main
int main()
{
string alpha[amt];
int a;
for(a =0; a < 20; a++)
{
cout<<"Enter your first name: ";
cin>>mystudent[a].firstName;
cout<<"Enter your last name: ";
cin>>mystudent[a].lastName;
cout<<"Enter your Address: ";
cin>>mystudent[a].add;
cout<<"Enter your school Id: ";
cin>>mystudent[a].id;
cout<<endl<<endl;
cout<<"*********************************";
cout<<endl<<endl;
}
//declare function
printStudent(alpha);



return 0;
}

Last edited on
alpha is an array of string, but the function printStudent expects an array of student.
so how do i re state it
See that array of student you have? Pass it that instead.
sorry i i am not following what array of student
student myStudent[20];
That array of student.
so it be passed as
printStudent(student myStudent)
Topic archived. No new replies allowed.