本文整理汇总了C++中writeln函数的典型用法代码示例。如果您正苦于以下问题:C++ writeln函数的具体用法?C++ writeln怎么用?C++ writeln使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeln函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decode_args
/* Returns false on an error */
static rbool decode_args(int ip,op_rec *oprec)
{
rbool grammer_arg; /* Have NOUN/OBJECT that is 0 and so failed argok tests */
if (oprec->errmsg!=NULL) {
if (!PURE_ERROR)
writeln(oprec->errmsg);
return 0;
}
if (DEBUG_AGT_CMD && !supress_debug) {
if (oprec->negate) { /* Output NOT */
debug_cmd_out(ip,108,0,0,0);
ip++;
}
}
if (DEBUG_AGT_CMD && !supress_debug)
debug_cmd_out(ip,oprec->op,oprec->arg1,oprec->arg2,oprec->optype);
/* This checks and translates the arguments */
if (!argok(oprec->opdata,&(oprec->arg1),&(oprec->arg2),
oprec->optype,&grammer_arg)) {
/* Don't report errors for null NOUN/OBJECT/ACTOR arguments
used in conditional tokens */
if (grammer_arg && oprec->op<=MAX_COND)
return 0;
if (!PURE_ERROR) {
if (DEBUG_AGT_CMD && !supress_debug) debugout("\n");
writeln("GAME ERROR: Invalid argument to metacommand token.");
}
return 0;
}
return 1;
}
示例2: sprintf
void
IGCWriter::header(const BrokenDateTime &DateTime,
const TCHAR *pilot_name, const TCHAR *aircraft_model,
const TCHAR *aircraft_registration,
const TCHAR *strAssetNumber, const TCHAR *driver_name)
{
char datum[] = "HFDTM100Datum: WGS-84";
char temp[100];
// Flight recorder ID number MUST go first..
sprintf(temp, "AXCS%c%c%c",
(char)strAssetNumber[0],
(char)strAssetNumber[1],
(char)strAssetNumber[2]);
writeln(temp);
sprintf(temp, "HFDTE%02u%02u%02u",
DateTime.day, DateTime.month, DateTime.year % 100);
writeln(temp);
if (!Simulator)
writeln(GetHFFXARecord());
write_tstring("HFPLTPILOT:", pilot_name);
write_tstring("HFGTYGLIDERTYPE:", aircraft_model);
write_tstring("HFGIDGLIDERID:", aircraft_registration);
write_tstring("HFFTYFR TYPE:XCSOAR,XCSOAR ", XCSoar_VersionStringOld);
write_tstring("HFGPS: ", driver_name);
writeln(datum);
if (!Simulator)
writeln(GetIRecord());
}
示例3: NyLPC_cHttpHeaderWriter_writeResponseHeader
/**
* ステータスラインと、標準メッセージヘッダを出力します。
*/
NyLPC_TBool NyLPC_cHttpHeaderWriter_writeResponseHeader(NyLPC_TcHttpHeaderWriter_t* i_inst,NyLPC_TUInt16 i_status)
{
NyLPC_TChar v[12];
const char* m=getStatusMessage(i_status);
//エラー状態ならなにもしない。
if(i_inst->_is_error){
return NyLPC_TBool_FALSE;
}
//検索に失敗したら500番に変更
if(m==NULL){
i_status=500;
m=getStatusMessage(500);
}
//ステータスラインの記述
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,"HTTP/1.1 ",9)){
NyLPC_OnErrorGoto(Error);
}
NyLPC_itoa(i_status,v,10);
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,v,-1)){
NyLPC_OnErrorGoto(Error);
}
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream," ",1)){
NyLPC_OnErrorGoto(Error);
}
if(!writeln(i_inst->_ref_stream,m,-1)){
NyLPC_OnErrorGoto(Error);
}
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,"Server: " NyLPC_cHttpdConfig_SERVER "\r\n",-1)){
NyLPC_OnErrorGoto(Error);
}
if(i_inst->_is_close){
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,"Connection: CLOSE\r\n",-1)){
NyLPC_OnErrorGoto(Error);
}
}
//ヘッダの記述
if(i_inst->_is_chunked){
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,"Transfer-Encoding: chunked\r\n",-1)){
NyLPC_OnErrorGoto(Error);
}
}else{
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,"Content-Length: ",-1)){
NyLPC_OnErrorGoto(Error);
}
NyLPC_uitoa(i_inst->_content_length,v,10);
if(!writeln(i_inst->_ref_stream,v,-1)){
NyLPC_OnErrorGoto(Error);
}
}
//送信サイズをリセット
i_inst->_size_of_sent=0;
return NyLPC_TBool_TRUE;
Error:
i_inst->_is_error=NyLPC_TUInt8_FALSE;
return NyLPC_TBool_FALSE;
}
示例4: CHECK_SETTINGS
void CHECK_SETTINGS (const string projectname) {
ASSERT_EXACTLY_ONE_TRUE (is_mode_STD(), is_mode_DEBUG());
const string SFN = capslock (projectname + ".set");
const string sfn = projectname + ".set";
writeln ("");
writeln ("============================");
writeln ("1) CHECKING OF SETTINGS FILE");
writeln ("============================");
writeln ("");
writeln (" - CHECKING " + SFN + " SETTINGS FILE");
const bool CORR_SET = is_SETTINGS_FILE_CORRECT (sfn);
if (CORR_SET) {
writeln (" - " + SFN + " SETTINGS FILE IS CORRECT.");
vector <vector <string> > SET = READ_SETTINGS_FILE (sfn);
SET = COMPLETE_SET_WITH_DEFAULT (SET);
INIT_SETTINGS (SET);
}
else {
writeln ("");
writeln (" WARNING, SET_ERROR: the input " + SFN + " file structure is incorrect, the file will not be processed.");
throw set_error();
}
}
示例5: fopen
ASTDumper::ASTDumper (Node *root, std::string outpath) {
file = fopen(outpath.c_str(), "w");
nodeCounter = 0;
writeln("digraph {");
root->accept(*this);
writeln("}");
fclose(file);
}
示例6: GetSIU
void
IGCWriter::LogPoint(const NMEA_INFO& gps_info)
{
char szBRecord[500];
int iSIU = GetSIU(gps_info);
fixed dEPE = GetEPE(gps_info);
LogPoint_GPSPosition p;
char IsValidFix;
// if at least one GPS fix comes from the simulator, disable signing
if (gps_info.gps.Simulator)
Simulator = true;
if (!Simulator) {
const char *p = frecord.update(gps_info.gps.SatelliteIDs,
gps_info.DateTime, gps_info.Time,
gps_info.gps.NAVWarning);
if (p != NULL)
writeln(p);
}
if (!LastValidPoint.Initialized &&
((gps_info.GPSAltitude < fixed(-100))
|| (gps_info.BaroAltitude < fixed(-100))
|| gps_info.gps.NAVWarning))
return;
if (gps_info.gps.NAVWarning) {
IsValidFix = 'V'; // invalid
p = LastValidPoint;
} else {
IsValidFix = 'A'; // Active
// save last active fix location
p = LastValidPoint = gps_info;
}
char *q = szBRecord;
sprintf(q, "B%02d%02d%02d",
gps_info.DateTime.hour, gps_info.DateTime.minute,
gps_info.DateTime.second);
q += strlen(q);
q = igc_format_location(q, p.Location);
sprintf(q, "%c%05d%05d%03d%02d",
IsValidFix, (int)gps_info.BaroAltitude, p.GPSAltitude,
(int)dEPE, iSIU);
writeln(szBRecord);
}
示例7: main
int main(){
list L = cons(1,cons(5,cons(3,cons(8,nil))));
write("Erlang: foldl (xmy, 0, L) = (8-(3-(5-(1-0)))) = ");
writeln(foldl(xmy, 0, L));
write("Haskell: foldlH(xmy, 0, L) = ((((0-1)-5)-3)-8) = ");
writeln(foldlH(xmy, 0, L));
write("Erlang: foldl (ymx, 0, L) = ((((0-1)-5)-3)-8) = ");
writeln(foldl(ymx, 0, L));
write("Haskell: foldlH(ymx, 0, L) = (8-(3-(5-(1-0)))) = ");
writeln(foldlH(ymx, 0, L));
write(" foldr (xmy, 0, L) = (1-(5-(3-(8-0)))) = ");
writeln(foldr(xmy, 0, L));
}
示例8: writeln
void LayerAndroid::dumpLayers(FILE* file, int indentLevel) const
{
writeln(file, indentLevel, "{");
writeHexVal(file, indentLevel + 1, "layer", (int)this);
writeIntVal(file, indentLevel + 1, "layerId", m_uniqueId);
writeIntVal(file, indentLevel + 1, "haveClip", m_haveClip);
writeIntVal(file, indentLevel + 1, "isRootLayer", m_isRootLayer);
writeIntVal(file, indentLevel + 1, "isFixed", m_isFixed);
writeFloatVal(file, indentLevel + 1, "opacity", getOpacity());
writeSize(file, indentLevel + 1, "size", getSize());
writePoint(file, indentLevel + 1, "position", getPosition());
writePoint(file, indentLevel + 1, "translation", m_translation);
writePoint(file, indentLevel + 1, "anchor", getAnchorPoint());
writePoint(file, indentLevel + 1, "scale", m_scale);
if (m_doRotation)
writeFloatVal(file, indentLevel + 1, "angle", m_angleTransform);
if (m_isFixed) {
writeLength(file, indentLevel + 1, "fixedLeft", m_fixedLeft);
writeLength(file, indentLevel + 1, "fixedTop", m_fixedTop);
writeLength(file, indentLevel + 1, "fixedRight", m_fixedRight);
writeLength(file, indentLevel + 1, "fixedBottom", m_fixedBottom);
writeLength(file, indentLevel + 1, "fixedMarginLeft", m_fixedMarginLeft);
writeLength(file, indentLevel + 1, "fixedMarginTop", m_fixedMarginTop);
writeLength(file, indentLevel + 1, "fixedMarginRight", m_fixedMarginRight);
writeLength(file, indentLevel + 1, "fixedMarginBottom", m_fixedMarginBottom);
writePoint(file, indentLevel + 1, "fixedOffset", m_fixedOffset);
writeIntVal(file, indentLevel + 1, "fixedWidth", m_fixedWidth);
writeIntVal(file, indentLevel + 1, "fixedHeight", m_fixedHeight);
}
if (m_recordingPicture) {
writeIntVal(file, indentLevel + 1, "picture width", m_recordingPicture->width());
writeIntVal(file, indentLevel + 1, "picture height", m_recordingPicture->height());
}
if (countChildren()) {
writeln(file, indentLevel + 1, "children = [");
for (int i = 0; i < countChildren(); i++) {
if (i > 0)
writeln(file, indentLevel + 1, ", ");
getChild(i)->dumpLayers(file, indentLevel + 1);
}
writeln(file, indentLevel + 1, "];");
}
writeln(file, indentLevel, "}");
}
示例9: show2e
void show2e(ar2e* arr) {
dom2d dom = arr->dom;
for_dom_d1(i1, dom) {
for_dom_d2(i2, dom)
printf("%s", tost(0, get2e(arr, i1, i2)));
writeln();
}
示例10: extract_obj
/* Basically, we need to find an object with a matching noun
and adj to our choice. */
static int extract_obj(word name, word adj)
{
int i,obj;
/* We just take the first one. We split this into separate noun and
creature loops for performance reaons */
if (name==-1) /* <*NONE*> */
return 0;
obj=expand_redirect(name);
adj=it_name(expand_redirect(adj));
if (obj>0) { /* $noun$, $object$, or $name$ */
if (adj==0 || adj==it_adj(obj))
return obj; /* We're done */
name=it_name(obj);
} else
name=-obj;
if (adj==0) return -name; /* Adjectives required for CLASS redirect */
nounloop(i)
if (noun[i].name==name && noun[i].adj==adj) return i+first_noun;
creatloop(i)
if (creature[i].name==name && creature[i].adj==adj)
return i+first_creat;
/* Hmm... just hope it's an internal noun. */
writeln("GAME ERROR: Redirect statement with bad object name.");
return -name;
}
示例11: ktov_hajlamot
void ktov_hajlamot (CStr path_to_hajlamot) {
ofstream out;
StringTemp thefilename = concat_path_to_filename(path_to_hajlamot,"hajlamotb.ma");
DO(open(thefilename.str,out,0));
writeln (out, mone_hajlamot_pealim, Format("P "));
out.close();
}
示例12: obj_cond
static int obj_cond(int op, int obj, int arg)
{
switch(op) {
case 0:cret(in_scope(obj)); /* Present--
Do we want to use visible here?? */
case 1:cret(is_within(obj,1000,1)); /* IsWearing */
case 2:cret(is_within(obj,1,1));
/* if (PURE_WEAR) return (it_loc(obj)==1); else */
case 3:cret(it_loc(obj)==0); /* Nowhere */
case 4:cret(it_loc(obj)!=0);
case 5:cret(!player_has(obj) && in_scope(obj));
case 6:cret(it_loc(obj)==arg);
case 7:cret(it_on(obj));
case 8:cret(!it_on(obj));
case 9:cret(it_open(obj));
case 10:cret(!it_open(obj));
case 11:cretn(obj,locked);
case 12:cret(!tnoun(obj) || !noun[obj-first_noun].locked);
case 13:cretn(obj,edible);
case 14:cretn(obj,drinkable);
case 15:cretn(obj,poisonous);
case 16:cretn(obj,movable);
default:
writeln("INTERNAL ERROR: Bad obj_cond value.");
return 2;
}
}
示例13: main
int main(){
short i,a,b; int q; char opt;
read(N);
for(i=1;i<N;++i) read2(a,b),addEdge(V+a,V+b);
for(i=1;i<=N;++i) read(V[i].w);
V->top=V;
V[1].BuildTree(V,1);
MakeChain();
scanf("%d\n",&q);
while(q--)
switch(opt=(getchar(),getchar()),read2(a,b),opt){
case 'H':V[a].Modify(b);break;
case 'M':writeln(Max(V+a,V+b));break;
case 'S':writeln(Sum(V+a,V+b));
}
}
示例14: ktov_lexicon_bituyim
void ktov_lexicon_bituyim(ostream& out, Format format="") {
out << '{' << endl;
for (Trie0<Bituy>::Cursor c(lexicon_bituyim); c.isvalid(); ++c) {
writeln (out, c.item());
}
out << '}' << endl;
}
示例15: writeln
void ASTDumper::edge(int a, int b) {
std::string buff = "node" + std::to_string(a) + " -> node" + std::to_string(b);
if (!desc.empty()) {
buff += " [label=\"" + desc + "\"]";
desc.clear();
}
writeln(buff);
}