-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_cgi.cc
53 lines (36 loc) · 1.31 KB
/
test_cgi.cc
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
#include <iostream>
#include "comm.hpp"
int main()
{
std::string query_string;
GetQueryString(query_string);
//a=100&b=200
std::string str1;
std::string str2;
CutString(query_string, "&", str1, str2);
std::string name1;
std::string value1;
CutString(str1, "=", name1, value1);
std::string name2;
std::string value2;
CutString(str2, "=", name2, value2);
//1 ->
std::cout << name1 << " : " << value1 << std::endl;
std::cout << name2 << " : " << value2 << std::endl;
//2
std::cerr << name1 << " : " << value1 << std::endl;
std::cerr << name2 << " : " << value2 << std::endl;
int x = atoi(value1.c_str());
int y = atoi(value2.c_str());
//可能向进行某种计算(计算,搜索,登陆等),想进行某种存储(注册)
std::cout << "<html>";
std::cout << "<head><meta charset=\"utf-8\"></head>";
std::cout << "<body>";
std::cout << "<h3> " << value1 << " + " << value2 << " = "<< x+y << "</h3>";
std::cout << "<h3> " << value1 << " - " << value2 << " = "<< x-y << "</h3>";
std::cout << "<h3> " << value1 << " * " << value2 << " = "<< x*y << "</h3>";
std::cout << "<h3> " << value1 << " / " << value2 << " = "<< x/y << "</h3>";
std::cout << "</body>";
std::cout << "</html>";
return 0;
}