iword.cpp

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C++ 代码 · 共 22 行

CPP
22
字号
#include <iostream.h>
#include <strstream.h>

void main( void ) {

    int       index1, index2;
    float     dollar1, dollar2;
    char      ch;

    istrstream     currency ( "23.4 26.6" );
    index1 = currency.xalloc();
    currency.iword( index1 ) = 36;
    index2 = currency.xalloc();
    currency.iword( index2 ) = 157;
    currency >> dollar1;
    currency >> dollar2;
    cout << "Canadian currency: CAN " << ( ch = currency.iword( index1 ) )
         << dollar1 << endl;
    cout << "Japanese currency: " << ( ch = currency.iword( index2 ) )
         << dollar2 << endl;
}

⌨️ 快捷键说明

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