Help Formatting

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std; 

const double Project_Weight = 0.40;
const double Exam_Weight = 0.60;

double processStudent();
double calculateProjectGrade(double, double, double, double);
double calculateExamGrade(double, double, double);
double calculateFinalGrade(double, double, double, double);
void displayGradeInformation();

int main()
{
	processStudent(); 
	processStudent(); 
	processStudent(); 
	processStudent(); 

return 0; 
}

double processStudent()
{
	double p1, p2, p3, p4, e1, e2, e3; 
	double average_Project, average_Exam, final_grade; 

	
	cout << "Enter the 4 Project grades: ";
		cin >>p1 ; cin >> p2; cin >> p3; cin >> p4; 
	average_Project = calculateProjectGrade(p1, p2, p3, p4); 

	cout << "Enter the 3 Exam grades: ";
		cin >> e1; cin >> e2; cin >> e3; 
	average_Exam = calculateExamGrade(e1, e2, e3); 

	average_Project = calculateProjectGrade(p1, p2, p3, p4); 
	average_Exam = calculateExamGrade(e1, e2, e3); 
	final_grade = calculateFinalGrade(average_Exam, average_Project, Project_Weight, Exam_Weight); 
	cout << "Average Project grade is: " << average_Project << endl;
	cout << "Average Exam grade is: " << average_Exam << endl; 
	cout << "Final grade is: " << final_grade << endl; 

	return average_Exam, average_Project, final_grade; 
	

}
double calculateProjectGrade(double p1, double p2, double p3, double p4)
{
	return (p1+p2+p3+p4)/4; 

}
double calculateExamGrade(double e1, double e2, double e3)
{
	return (e1+e2+e3)/ 3; 
}
double calculateFinalGrade(double calculateExamGrade, double calculateProjectGrade, double Project_Weight, double Exam_Weight)
{
	return (calculateExamGrade * Exam_Weight) + (calculateProjectGrade * Project_Weight); 
}

void displayGradeInformation()
{
	
	double calculateExamGrade, calculateProjectGrade, calculateFinalGrade; 

	cout << setw(20) << "Type" << setw(20) << "Average" << cout << setw(20) << "Weight\n"; 
	
	

	cout << "Average Project grade is: " << calculateProjectGrade << endl;
	cout << "Average Exam grade is: " << calculateExamGrade << endl; 
	cout << "Final grade is: " << calculateFinalGrade<< endl; 




}

Needs to look like this: http://i.gyazo.com/fcdaddcdb9e1adde06bb9d9f652947cc.png
Thanks in advance!
You can't return more than one variable ._. use reference or pointer parameter instead
For the formatting there's a header called iomanip
Last edited on
Topic archived. No new replies allowed.