#include<iostream>
#include<iomanip>
using namespace std;
struct Student
{
char Name[30];
float GPA;
int Major;
};
//Function prototypes
Student* StudentData(Student* S);
void display(Student* S);
void ChangeData(Student* S);
Student Students[2];
void GetStudents(Student array[], int& size);
//Main information build
int main()
{
//Declare two objects of type 'Student' as wanted in step #1
Student* S1 = new Student;
Student* S2 = new Student;
//Pass this object into the function so it can be filled up with useful information as wanted in step #2
S1 = StudentData(S2);
//Display new and exciting information as specified in step #3
display(S1);
display(S2);
//Function call to change data in S2 as specified in step #4
ChangeData(S2);
//Displays ChangeData
display(S2);
//Array
Student Students[2];
return 0;
}
//Function Definitions Which Ask For User Input And Displays Them
Student* StudentData(Student* S)
{
cout << "Enter name: ";
cin >> S->Name;
cout << "Enter GPA: ";
cin >> S->GPA;
cout << "Enter major: " ;
cin >> S->Major;
return S;
}
void display(Student* S)
{
cout << " " << endl;
cout << "Name: " << S->Name << endl;
cout << "GPA: " << S->GPA << endl;
cout << "Major: " << S->Major << endl;
cout << " " << endl;
}
void ChangeData(Student* S)
{
cout << "\nEnter name: ";
cin >> S->Name;
cout << "Enter GPA: ";
cin >> S->GPA;
cout << "Enter Major: " ;
cin >> S->Major;
}
void GetStudents(Student array[], int& size)
{
for(int i=0; i<size; i++)
{
cout << "Enter name: ";
cin.getline(array[i]->Name, 30);
cout << "Enter GPA: ";
cin >> array[i]->GPA;
cout << "please enter major: " ;
cin >> array[i]->Major;
cin.ignore(1);
}
}
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
Clinton Portis 211 Practically a Posting Shark
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
Clinton Portis 211 Practically a Posting Shark
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
Clinton Portis 211 Practically a Posting Shark
Clinton Portis 211 Practically a Posting Shark
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
Clinton Portis 211 Practically a Posting Shark
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
Clinton Portis 211 Practically a Posting Shark
EliteApple 0 Junior Poster in Training
Clinton Portis 211 Practically a Posting Shark
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
Clinton Portis 211 Practically a Posting Shark
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
EliteApple 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.