Respuesta :
Answer:
C++.
Explanation:
#include <iostream>
#include <string>
using namespace std;
///////////////////////////////////////////////////////////////////
struct Student {
string name;
float exam1;
float exam2;
};
///////////////////////////////////////////////////////////////////
Student create_student() {
string name;
cout<<"Name: ";
cin>>name;
float exam1;
cout<<"Exam 1: ";
cin>>exam1;
float exam2;
cout<<"Exam 2: ";
cin>>exam2;
Student s;
s.name = name;
s.exam1 = exam1;
s.exam2 = exam2;
return s;
}
///////////////////////////////////////////
Student* create_class(int n) {
Student* arr = new Student[n];
for (int i=0; i<n; i++) {
cout<<"Student "<<i+1<<endl;
arr[i] = create_student();
cout<<endl;
}
return arr;
}
///////////////////////////////////////////
float calculate_score(Student s) {
int final_score = 0;
if (s.exam1 >= s.exam2) {
final_score = (s.exam1 * 0.3) + (s.exam2 * 0.7);
}
else {
final_score = (s.exam1 * 0.7) + (s.exam2 * 0.3);
}
return final_score;
}
///////////////////////////////////////////////////////////////////
int main() {
Student* s;
int n;
////////////////////////////////////
cout<<"How many students? ";
cin>>n;
cout<<endl;
s = create_class(n);
////////////////////////////////////
for(int i=0; i<n; i++) {
float final_score = calculate_score(s[i]);
printf("Final score for Student %d %.2f", i+1, final_score);
cout<<endl;
}
////////////////////////////////////
return 0;
}