加载中
C语言下载网页源代码(Linux环境)

#include <stdio.h> #include <netdb.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/socket.h> #include <netinet/in.h> #include...

2017/06/06 23:11
503
用fputs() 函数来向指定的文件写入一个字符串

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){   FILE *fp;   char str[102] = {0}, strTemp[100];   if((fp=fopen("testfile", "a+")) == ...

2016/04/10 22:53
879
用fgets()函数以字符串形式读取磁盘文件并输出到屏幕

fgets() 函数用来从指定的文件中读取一个字符串,并保存到字符数组中,它的原型为: char *fgets ( char *str, int n, FILE *fp ); str 为字符数组,n 为要读取的字符数目,fp 为文件指针。 ...

2016/04/10 22:27
585
用fputc()函数以字符串形式写入字符到磁盘文件

#include <stdio.h> #include <stdlib.h> int main(){   FILE *fp;   char ch;   if((fp=fopen("testfile", "a")) == NULL){     fprintf(stderr, "Error opening f...

2016/04/10 22:16
709
递归

scheme代码: ;;; Method1 -- count the sum of digit before x (define (sum1 x)   (do ((n 0 (+ 1 n))        (sum 0 (+ sum n)))     ((> n x) sum...

2016/02/19 01:48
93
Common Lisp牛顿法求平方根

1)牛顿法求平方根: 公式:(y + x/y) / 2,首先猜测为1,然后逐渐逼近。 (defun sqrt-iter (guess x)   (if (good-enough? guess x)       guess       (sqrt-iter (...

2016/02/03 03:34
517
Common Lisp 宏

1)简单的宏 CL-USER> (defmacro print-test (x y)        `(format t "~A ~A~%" ,x ,y)) PRINT-TEST CL-USER> (print-test 'hello 'world) HELLO WORLD NIL 2) 3)...

2016/01/14 00:10
199
Common Lisp简单排序

1)用sort函数进行排序 CL-USER> (sort "elbow" #'char<) "below" CL-USER> (sort '(a c b s) #'string<) (A B C S) CL-USER> (sort '(39 48 28 4 32) #'<) (4 28 32 ...

2016/01/07 00:42
631
Common Lisp集合运算

集合论中的并集 (union)、交集 (intersection)以及补集 (complement)的实现,是由函数 union 、 intersection 以及 set-difference 。还有判断数组蕴涵subsetp CL-USER> (setf list1 '(a...

2016/01/05 00:14
191
Common Lisp专题4:数组

1)用make-array创建数组: CL-USER> (make-array 5 :initial-element nil) #(NIL NIL NIL NIL NIL) CL-USER> (make-array 5 :initial-contents '(a e i o u)) #(A E I O...

2016/01/03 22:02
401
Common Lisp专题3:文件操作

1)读取文件 用with-open-file函数打开文件 CL-USER> (defun my-read-file ()        (with-open-file (stream "d:/test.lisp")          (do ((my-file (read-line ...

2015/12/28 00:06
995
Common Lisp循环和递归

循环: 1)do循环 语法:(do ((变量名 变量初值 (变量变化语句))) (结束条件 返回值) 循环主体) CL-USER> (defun draw-line (x)        (do ((i 0 (1+ i)))          ...

2015/12/27 02:08
531
Common Lisp专题1:Function and Data

1)基本的数学函数: + Adds two numbers - Subtracts the second number from the first * Multiplies two numbers / Divides the first number by the second ABS Absolute value of a numb...

2015/12/27 01:48
86
Java中的函数重载(override)

area()函数重载

2015/12/08 22:38
83
成员访问与继承

例一:超类和子类使用默认构造函数;例二:子类使用显示构造函数,超类使用默认构造函数;例三:超类使用显示构造函数,子类用super()函数执行超类的构造函数。

2015/12/08 01:02
121
Java快速排序

package pratise; class Quicksort{          //set up a call to the actual Quicksort method.     static void qsort(char items[]){         qs(item...

2015/12/07 23:55
51
用for-each循环迭代多维数组

package pratise; public class Construct {     public static void main(String[] args) {         int sum = 0;         int nums[][] = new int...

2015/12/07 18:26
138
简单print网页源代码

#! /usr/bin/perl use strict; use warnings; use LWP::Simple qw(get); my $html = get("http://www.baidu.com"); print $html; 把网页源代码保存到本地: #! /usr/bin/perl use...

2015/12/01 01:17
421
C语言下载网页源代码并保存到本地磁盘

#include <stdio.h> #include <string.h> #include <stdlib.h> #include <winsock2.h> #pragma comment(lib, "ws2_32.lib") int geturl(char *url) {     /****************解...

2015/11/24 02:20
1.6K

没有更多内容

加载失败,请刷新页面

返回顶部
顶部