Program 1 needs to create an array to save the number of students(column) and the number of exams(row). The Program 1 needs to calculate the student's average and class average. Create and call a function that calculates the exam averages for each student and place them in an additional column(the column could already be there waiting for this function). This function shold also cout/rpint all of the averages to the screen. Back in the main, cout the class average (1 number).
Program 1 Code
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
void readgrade();
void average();
void classaverage();
using namespace std;
void readgrade()
{
int m,n; //m means exam numbers, n means student numbers
int i,j;
float score[n][m];
cout << "How many students " << endl;
cin >> n;
for (i = 0; i < n; i++) // Input data
{
cout << "How many exam numbers "<< endl;
cin >> m;
cout << "Input Student " << i+1 << "'s No. "<< m <<" grade" << endl;
for(j = 0; j < m; j++)
cin >> score[i][j];
}
}
void average()
{
int i, j, m, n;
float score[n][m+1];
float s;
readgrade();
for(i = 0; i < n; i++) //calculate average
{
for(j = 0; j < m; j++)
s = 0.0;
s = s + score[i][j];
score[n][m+1]=s / (n+1);
cout << "No. " << i+1 << " Student's Average: " << score[n][m+1] << endl;
}
}
int main()
{
readgrade();
average();
classaverage();
return 0;
}
Program 2 is to calculate the Black Scholes model
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
double N(double);
double d1(double,double,double,double);
double d2(double,double,double,double,double);
double C(double,double,double,double,double);
double P(float,float,float,float,float);
Can you post the code in the format style. There is a button on the right side with two arrows. For instance post it like this post it like this. It is much easier for us to detect the problem