#include <cppcms/service.h>
#include <cppcms/application.h>
#include <cppcms/applications_pool.h>
#include <cppcms/cache_interface.h>
#include <iostream>
#include <sstream>
#include "content.h"
public:
{
}
{
c.arg=0;
c.fact=1;
if(
request().request_method()==
"POST") {
if(c.info.validate()) {
c.arg=c.info.arg.value();
c.info.clear();
}
else {
return;
}
}
std::ostringstream key;
key << "factorial_" << c.arg;
if(
cache().fetch_page(key.str()))
return;
long long int f=1;
for(int i=1;i<=c.arg;i++) {
f*=i;
}
c.fact=f;
}
};
int main(
int argc,
char ** argv)
{
try {
app.applications_pool().mount(cppcms::applications_factory<hello>());
app.run();
}
catch(std::exception const &e) {
std::cerr<<e.what()<<std::endl;
}
}