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

📄 cpasdemo.c

📁 该包是数据结构的实验软件,来源于合肥工业大学人工智能与数据挖掘实验室,用来实现数据结构.
💻 C
字号:
/* Copyright (c) 1987,1991 by Borland International, Inc.

   This module demonstrates how to write Turbo C++ routines that
   can be linked into a Turbo Pascal program. Routines in this
   module call Turbo Pascal routines in CPASDEMO.PAS.

   See the instructions in the file CPASDEMO.PAS on running
   this demonstration program */

typedef unsigned int word;
typedef unsigned char byte;
typedef unsigned long longword;

extern void setcolor(byte newcolor);  /* procedure defined in
                                         Turbo Pascal program */
extern word factor;    /* variable declared in Turbo Pascal program */

word sqr(int i)
{
  setcolor(1);
  return(i * i);
} /* sqr */

word hibits(word w)
{
  setcolor(2);
  return(w >> 8);
} /* hibits */

byte suc(byte b)
{
  setcolor(3);
  return(++b);
} /* suc */

byte upr(byte c)
{
  setcolor(4);
  return((c >= 'a') && (c <= 'z') ? c - 32 : c);
} /* upr */

char prd(char s)
{
  setcolor(5);
  return(--s);
} /* prd */

long lobits(long l)
{
  setcolor(6);
  return((longword)l & 65535L);
} /* lobits */

void strupr(char *s)
{
  int counter;

  for (counter = 1; counter <= s[0]; counter++)  /* Note that the routine */
    s[counter] = upr(s[counter]);                /* skips Turbo Pascal's  */
  setcolor(7);                                   /* length byte           */
} /* strupr */

byte boolnot(byte b)
{
  setcolor(8);
  return(b == 0 ? 1 : 0);
} /* boolnot */

word multbyfactor(word w)
{
  setcolor(9);        /* note that this function accesses the Turbo Pascal */
  return(w * factor); /* declared variable factor */
} /* multbyfactor */

⌨️ 快捷键说明

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