69 757
Assignments Done
Successfully Done
In February 2019

Answer to Question #58993 in C++ for aventador

Question #58993
Question 2
Figure below shows that Student is a structure consisting of four different objects. The figure below illustrates how a struct is declared, how its constituent data members are accessed, and how it can be passed as a parameter to a function. You need to calculate the grade point average from the given pointer1 and pointer2. We have the declaration:
Student s;
struct number
string firstName;
string 1astName;
int studentNum;
int pointer1;
int pointer2;
Write a program that produce an output that will call struct Student for last name, first name, pointer1 and pointer 2 for a student named Mary.
Expert's answer

using namespace std;

struct Student
string firstName;
string lastName;
int studentNum;
int pointer1;
int pointer2;
void print();
void Student::print()
cout << "Last name " << lastName << " first name " << firstName << " pointer1 " << pointer1 << " pointer2 " << pointer2 << endl;
double aver(Student s);
int main()
Student Mary;
Mary.firstName = "Mary";
Mary.lastName = "Green";
Mary.pointer1 = 5;
Mary.pointer2 = 4;
cout << aver(Mary) << endl;
return 0;
double aver(Student s)
return (double)(s.pointer1 + s.pointer2) / 2.0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions