- 论坛徽章:
- 0
|
本帖最后由 daniel_kohler 于 2012-05-25 13:18 编辑
回复 5# 雪中的紫诺
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- char *data;
- long m = 0, n = 0;
-
- printf("%s\n\n", "Content-Type:text/html;charset=gb2312");
- printf("<html> <head>\n");
- printf("<title> hello world </title> \n");
- printf("</head>\n");
- printf("<body> \n");
-
- data = getenv("QUERY_STRING");
- if(data != NULL){
- if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2){
- printf("< P >错误!输入数据非法。表单中输入的必须是数字。</p>");
- }else{
- printf("< P >%ld和%ld的成绩是:%ld。</p>",m,n,m*n);
- }
- }else{
- printf("data is null");
- }
-
- printf("</body> </html> \n");
- return 0;
- }
复制代码 |
|