Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65195585
compute_arithmetic.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jun 1, 18:06
Size
467 B
Mime Type
text/x-c++
Expires
Mon, Jun 3, 18:06 (2 d)
Engine
blob
Format
Raw Data
Handle
18023237
Attached To
R9484 sp4e-homework-lars-bertil
compute_arithmetic.hh
View Options
#ifndef COMPUTEARITHMETIC_HPP
#define COMPUTEARITHMETIC_HPP
#include "series.hh"
class
ComputeArithmetic
:
public
Series
{
public
:
//PREVIOUS IMPLEMENTATION:
//double compute(unsigned int N) {
// double result = 0;
// for (int a = 1; a<=N; ++a) {
// result=result+a;
// }
// return result;
//}
double
computeValue
(
int
k
)
{
return
1.
*
k
;
}
double
getAnalyticPrediction
()
{
return
1.
*
current_index
*
(
current_index
+
1.
)
/
2.
;
}
};
#endif
Event Timeline
Log In to Comment