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

📄 div.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
字号:
.func div
#include <stdlib.h>
div_t div( int numer, int denom );

typedef struct {
    int quot;     /* quotient */
    int rem;      /* remainder */
} div_t;
.funcend
.*
.desc begin
The &func function calculates the quotient
and remainder of the division of the numerator
.arg numer
by the denominator
.arg denom.
.desc end
.*
.return begin
The &func function returns a structure of type
.kw div_t
which contains the fields
.kw quot
and
.kw rem.
.return end
.*
.see begin
.seelist div ldiv lldiv imaxdiv
.see end
.*
.exmp begin
#include <stdio.h>
#include <stdlib.h>

void print_time( int seconds )
{
     div_t  min_sec;

     min_sec = div( seconds, 60 );
     printf( "It took %d minutes and %d seconds\n",
             min_sec.quot, min_sec.rem );
}
.exmp break
void main( void )
{
    print_time( 130 );
}
.exmp output
It took 2 minutes and 10 seconds
.exmp end
.class ISO C90
.system

⌨️ 快捷键说明

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