找回密码
 欢迎注册
楼主: plp626

[讨论] 一个计算圆周率任意精度的spigot算法研究

[复制链接]
发表于 2011-4-27 13:27:24 | 显示全部楼层
60# liangbch
dev-cpp 连续六年没有更新,自然GCC也是很老很老的。
====================
用dev-cpp 还不如用code::blocks
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-27 13:29:23 | 显示全部楼层
本帖最后由 ▄︻┻═┳一‥ 于 2011-4-27 13:31 编辑

61# wayne

code::blocks 好像不支持命令行编译。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-27 13:30:14 | 显示全部楼层
62# ▄︻┻═┳一‥
你的意思是说dev-cpp支持命令行。。。。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-27 13:35:16 | 显示全部楼层
63# wayne


恩,你在devcpp的bin目录下可以用cmd 查看 gcc --help
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-27 13:38:50 | 显示全部楼层
dev-cpp里面的gcc
  1. C:\Program Files\Dev-Cpp\bin

  2. ->gcc --help
  3. Usage: gcc [options] file...
  4. Options:
  5.   -pass-exit-codes         Exit with highest error code from a phase
  6.   --help                   Display this information
  7.   --target-help            Display target specific command line options
  8.   (Use '-v --help' to display command line options of sub-processes)
  9.   -dumpspecs               Display all of the built in spec strings
  10.   -dumpversion             Display the version of the compiler
  11.   -dumpmachine             Display the compiler's target processor
  12.   -print-search-dirs       Display the directories in the compiler's search path

  13.   -print-libgcc-file-name  Display the name of the compiler's companion library
  14.   -print-file-name=<lib>   Display the full path to library <lib>
  15.   -print-prog-name=<prog>  Display the full path to compiler component <prog>
  16.   -print-multi-directory   Display the root directory for versions of libgcc
  17.   -print-multi-lib         Display the mapping between command line options and
  18.                            multiple library search directories
  19.   -print-multi-os-directory Display the relative path to OS libraries
  20.   -Wa,<options>            Pass comma-separated <options> on to the assembler
  21.   -Wp,<options>            Pass comma-separated <options> on to the preprocessor

  22.   -Wl,<options>            Pass comma-separated <options> on to the linker
  23.   -Xlinker <arg>           Pass <arg> on to the linker
  24.   -save-temps              Do not delete intermediate files
  25.   -pipe                    Use pipes rather than intermediate files
  26.   -time                    Time the execution of each subprocess
  27.   -specs=<file>            Override built-in specs with the contents of <file>
  28.   -std=<standard>          Assume that the input sources are for <standard>
  29.   -B <directory>           Add <directory> to the compiler's search paths
  30.   -b <machine>             Run gcc for target <machine>, if installed
  31.   -V <version>             Run gcc version number <version>, if installed
  32.   -v                       Display the programs invoked by the compiler
  33.   -###                     Like -v but options quoted and commands not executed
  34.   -E                       Preprocess only; do not compile, assemble or link
  35.   -S                       Compile only; do not assemble or link
  36.   -c                       Compile and assemble, but do not link
  37.   -o <file>                Place the output into <file>
  38.   -x <language>            Specify the language of the following input files
  39.                            Permissible languages include: c c++ assembler none
  40.                            'none' means revert to the default behavior of
  41.                            guessing the language based on the file's extension

  42. Options starting with -g, -f, -m, -O, -W, or --param are automatically
  43. passed on to the various sub-processes invoked by gcc.  In order to pass
  44. other options on to these processes the -W<letter> options must be used.

  45. For bug reporting instructions, please see:
  46. <URL:http://www.mingw.org/bugs.shtml>.
复制代码
mingw 里面的gcc:
  1. C:\MinGW\bin
  2. ->gcc --help
  3. Usage: gcc [options] file...
  4. Options:
  5.   -pass-exit-codes         Exit with highest error code from a phase
  6.   --help                   Display this information
  7.   --target-help            Display target specific command line options
  8.   --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,
  9. ...]
  10.                            Display specific types of command line options
  11.   (Use '-v --help' to display command line options of sub-processes)
  12.   --version                Display compiler version information
  13.   -dumpspecs               Display all of the built in spec strings
  14.   -dumpversion             Display the version of the compiler
  15.   -dumpmachine             Display the compiler's target processor
  16.   -print-search-dirs       Display the directories in the compiler's search path

  17.   -print-libgcc-file-name  Display the name of the compiler's companion library
  18.   -print-file-name=<lib>   Display the full path to library <lib>
  19.   -print-prog-name=<prog>  Display the full path to compiler component <prog>
  20.   -print-multi-directory   Display the root directory for versions of libgcc
  21.   -print-multi-lib         Display the mapping between command line options and
  22.                            multiple library search directories
  23.   -print-multi-os-directory Display the relative path to OS libraries
  24.   -print-sysroot           Display the target libraries directory
  25.   -print-sysroot-headers-suffix Display the sysroot suffix used to find headers
  26.   -Wa,<options>            Pass comma-separated <options> on to the assembler
  27.   -Wp,<options>            Pass comma-separated <options> on to the preprocessor

  28.   -Wl,<options>            Pass comma-separated <options> on to the linker
  29.   -Xassembler <arg>        Pass <arg> on to the assembler
  30.   -Xpreprocessor <arg>     Pass <arg> on to the preprocessor
  31.   -Xlinker <arg>           Pass <arg> on to the linker
  32.   -combine                 Pass multiple source files to compiler at once
  33.   -save-temps              Do not delete intermediate files
  34.   -save-temps=<arg>        Do not delete intermediate files
  35.   -no-canonical-prefixes   Do not canonicalize paths when building relative
  36.                            prefixes to other gcc components
  37.   -pipe                    Use pipes rather than intermediate files
  38.   -time                    Time the execution of each subprocess
  39.   -specs=<file>            Override built-in specs with the contents of <file>
  40.   -std=<standard>          Assume that the input sources are for <standard>
  41.   --sysroot=<directory>    Use <directory> as the root directory for headers
  42.                            and libraries
  43.   -B <directory>           Add <directory> to the compiler's search paths
  44.   -b <machine>             Run gcc for target <machine>, if installed
  45.   -V <version>             Run gcc version number <version>, if installed
  46.   -v                       Display the programs invoked by the compiler
  47.   -###                     Like -v but options quoted and commands not executed
  48.   -E                       Preprocess only; do not compile, assemble or link
  49.   -S                       Compile only; do not assemble or link
  50.   -c                       Compile and assemble, but do not link
  51.   -o <file>                Place the output into <file>
  52.   -x <language>            Specify the language of the following input files
  53.                            Permissible languages include: c c++ assembler none
  54.                            'none' means revert to the default behavior of
  55.                            guessing the language based on the file's extension

  56. Options starting with -g, -f, -m, -O, -W, or --param are automatically
  57. passed on to the various sub-processes invoked by gcc.  In order to pass
  58. other options on to these processes the -W<letter> options must be used.

  59. For bug reporting instructions, please see:
  60. <http://gcc.gnu.org/bugs.html>.

  61. ->
复制代码
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-27 21:45:04 | 显示全部楼层
64# ▄︻┻═┳一‥
额,你这个不能叫dev-cpp的命令行。。。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-28 06:39:51 | 显示全部楼层
66# wayne
  1. D:\program files\CodeBlocks>dir/a/b/s *.exe
  2. D:\program files\CodeBlocks\cb_console_runner.exe
  3. D:\program files\CodeBlocks\codeblocks.exe
  4. D:\program files\CodeBlocks\uninstall.exe
复制代码
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-4-28 06:45:19 | 显示全部楼层
67# ▄︻┻═┳一‥
这样的命令才差不多,呵呵,个人感觉。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-5-6 20:54:41 | 显示全部楼层
5# plp626


奉上我的批处理习作。我的第一个用于数值计算的批处理程序。这个程序可计算n的阶乘。n>=1, 代码如下:
  1. @echo off

  2. setlocal enabledelayedexpansion

  3. echo To calculate n^^!
  4. set/p nn=n=?

  5. set/a "buff_1=1,rad=10000,len=1"

  6. for /l %%i in (1,1,%nn% ) do (
  7.         set/a cc=0
  8.         for /l %%j in (1,1,!len!) do (
  9.            set/a "tt=buff_%%j* %%i+!cc!"
  10.            set/a "buff_%%j=!tt! %% !rad!,cc=!tt!/!rad!"
  11.         )
  12.         if  !cc! gtr 0 (
  13.            set/a len+=1
  14.            set/a buff_!len!=!cc!
  15.         )  
  16. )

  17. set/p xx=n^^!=<nul
  18. set/a tt=buff_%len%
  19. set/p xx=!tt!<nul
  20. set/a len-=1

  21. for /l %%i in (%len%,-1,1 ) do (
  22.     set/a tt=buff_%%i
  23.     if !tt! lss 1000 set tt=00000!tt!
  24.     set/p xx=!tt:~-4!<nul
  25. )

  26. echo.
复制代码

评分

参与人数 1贡献 +1 鲜花 +1 收起 理由
▄︻┻═┳一‥ + 1 + 1 学得真快

查看全部评分

毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2011-5-16 20:40:06 | 显示全部楼层
向上面的两位求助。
有个提取文本,想用批处理完成。
有多个*.html 文件,要求提取出 <pre> A </pre>  之间的c 数据结构A.

A中有<>也要去掉,得到的c语言数据结构A保存到同一个文本文件中。
比如:
  1. <pre>
  2.           typedef struct _ALPC_HANDLE_TABLE       // 4 elements, 0x18 bytes (sizeof)
  3.           {
  4. /*0x000*/     struct <a href="ALPC_HANDLE_ENTRY.html">_ALPC_HANDLE_ENTRY</a>* Handles;
  5. /*0x008*/     ULONG32      TotalHandles;
  6. /*0x00C*/     ULONG32      Flags;
  7. /*0x010*/     struct <a href="EX_PUSH_LOCK.html">_EX_PUSH_LOCK</a> Lock;          // 7 elements, 0x8 bytes (sizeof)
  8.           }ALPC_HANDLE_TABLE, *PALPC_HANDLE_TABLE;
  9. </pre>
复制代码
变成:
  1. typedef struct _ALPC_HANDLE_TABLE       // 4 elements, 0x18 bytes (sizeof)
  2.           {
  3. /*0x000*/     struct _ALPC_HANDLE_ENTRY* Handles;
  4. /*0x008*/     ULONG32      TotalHandles;
  5. /*0x00C*/     ULONG32      Flags;
  6. /*0x010*/     struct _EX_PUSH_LOCK Lock;          // 7 elements, 0x8 bytes (sizeof)
  7.           }ALPC_HANDLE_TABLE, *PALPC_HANDLE_TABLE;
复制代码

file.rar

2.45 KB, 下载次数: 1, 下载积分: 金币 -1 枚, 经验 1 点, 下载 1 次

毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2024-4-24 14:39 , Processed in 0.069452 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表