C++合约ID转换为简明合约代码

#include<iostream>
#include "common.h"
#include<string>
#include <ctype.h>
#include<boost/date_time.hpp>
#include "Dictionary.h"
using namespace std;
using namespace boost::gregorian;
using namespace boost;

void GetShortInstrument(SWInstrumentIDDataType InstrumentID, SWShortInstrumentIDDataType szShortInstrumentID);
void main()
{

SWShortInstrumentIDDataType szRes;
SWInstrumentIDDataType myInstrumentID;
strcpy(myInstrumentID, "IF1305");

GetShortInstrument(myInstrumentID, szRes);
cout << szRes << endl;
int wait;
cin >> wait;

}

void GetShortInstrument(SWInstrumentIDDataType InstrumentID, SWShortInstrumentIDDataType szShortInstrumentID)
{

int i = 0;
while (InstrumentID[i] != '\0' && !isdigit(InstrumentID[i]) && i < 5)
{
szShortInstrumentID[i] = InstrumentID[i];
++i;
}

szShortInstrumentID[i] = '\0';
}

 

 

posted @ 2013-07-20 13:28  Predator  阅读(216)  评论(0编辑  收藏  举报