⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cross.c

📁 早期freebsd实现
💻 C
字号:
/*        This program is, essentially, a cross product generator.  It takes        an input file which is said to consist of a number of lines, and        expands each line.  A line like                (a,b)(c,d)        will be expanded to lines like                ac                ad                bc                bd        (without regard for the ORDER of the output; ie: the lines can appear        in any order).        Parenthesis can be nested, so                (a,b)(c(d,e),f)        will produce                acd                ace                af                bcd                bce                bf */#include <stdio.h>char leftParen,                         /* The left parenthesis character */        rightParen;                     /* The right parenthesis character *//* Finds next occurrence of 'character' at this level of nesting.        Returns 0 if no such character found. */char *ThisLevel(string, character)char *string, character;{        int level;                      /* Level 0 is OUR level */        level = 0;        while (*string != '\0') {                if (*string == leftParen)                        level++;                else if (*string == rightParen) {                        level--;                        if (level < 0)                                return(0);                }                if ((level == 0) && (*string == character))                                return(string);                string++;        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -