hey guys !!
i have to search an array of struct students on the basis of their first names, last names and roll numbers ..
so far i am done with the input of the student first , last names and roll numbers . i have problem in searching the array .. my code is :
Code:
#include <iostream>
Code:
#include <string>
using namespace std;
struct Student
{
string FirstName ;
string LastName ;
int RollNo ;
int semester ;
};
void inputFromUser (Student S[] );
void SortArray (Student S[]);
void showStudents (Student S[]);
int main ()
{
Student *S = new Student [3] ;
inputFromUser(S);
showStudents(S);
SortArray(S);
system("pause");
return 0 ;
}
void inputFromUser (Student S[])
{
for ( int i = 0 ; i<3 ; i++)
{
cout << " enter the first name " << endl;
cin >> S[i].FirstName ;
cout << " enter last name " << endl;
cin >> S[i].LastName ;
cout << " enter roll number " << endl;
cin >> S[i].RollNo ;
}
}
void showStudents (Student S[])
{
cout << " the names entered are " << endl;
for ( int i = 0 ; i<3 ; i++ )
{
cout << S[i].RollNo << "" << S[i].FirstName << " " << S[i].LastName << endl;
}
}
void SortArray (Student S[] )
{
for (int i = 0 ; i<3 ; i++ )
{
}
}