Changes in doc/user/user.tex [200fcb3:ba80f99]
- File:
-
- 1 edited
-
doc/user/user.tex (modified) (45 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
r200fcb3 rba80f99 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Tue Dec 11 23:19:26201814 %% Update Count : 3 40013 %% Last Modified On : Fri Aug 31 07:54:50 2018 14 %% Update Count : 3396 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 178 178 int main( void ) { 179 179 int x = 0, y = 1, z = 2; 180 ®sout | x | y | z ;®§\indexc{sout}§180 ®sout | x | y | z | endl;®§\indexc{sout}§ 181 181 } 182 182 \end{cfa} … … 513 513 Floating exponentiation\index{exponentiation!floating} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the base cannot be negative. 514 514 \begin{cfa} 515 sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi) ;515 sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi) | endl; 516 516 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i 517 517 \end{cfa} … … 547 547 548 548 549 \subsection{Loop Control} 549 %\subsection{\texorpdfstring{\protect\lstinline@for@ Statement}{for Statement}} 550 \subsection{\texorpdfstring{\LstKeywordStyle{for} Statement}{for Statement}} 550 551 551 552 The ©for©/©while©/©do-while© loop-control allows empty or simplified ranges. … … 556 557 the down-to range ©-~=©\index{-~=@©-~=©} means inclusive range [N,M]. 557 558 ©0© is the implicit start value; 558 ©1© is the implicit increment value. 559 The up-to range uses ©+=© for increment; 560 the down-to range uses ©-=© for decrement. 559 ©1© is the implicit increment value for an up-to range and ©-1© for an implicit down-to range. 561 560 The loop index is polymorphic in the type of the start value or comparison value when start is implicitly ©0©. 562 561 \begin{cquote} 563 562 \begin{tabular}{@{}ll|l@{}} 564 \multicolumn{2}{c|}{ loopcontrol} & \multicolumn{1}{c}{output} \\563 \multicolumn{2}{c|}{for control} & \multicolumn{1}{c}{output} \\ 565 564 \hline 566 565 \begin{cfa} … … 572 571 for ( ®10® ) { sout | "A"; } 573 572 for ( ®1 ~= 10 ~ 2® ) { sout | "B"; } 574 for ( ®10 -~= 1 ~ 2® ) { sout | "C"; }573 for ( ®10 -~= 1 ~ -2® ) { sout | "C"; } 575 574 for ( ®0.5 ~ 5.5® ) { sout | "D"; } 576 575 for ( ®5.5 -~ 0.5® ) { sout | "E"; } 577 576 for ( ®i; 10® ) { sout | i; } 578 577 for ( ®i; 1 ~= 10 ~ 2® ) { sout | i; } 579 for ( ®i; 10 -~= 1 ~ 2® ) { sout | i; }578 for ( ®i; 10 -~= 1 ~ -2® ) { sout | i; } 580 579 for ( ®i; 0.5 ~ 5.5® ) { sout | i; } 581 580 for ( ®i; 5.5 -~ 0.5® ) { sout | i; } 582 581 for ( ®ui; 2u ~= 10u ~ 2u® ) { sout | ui; } 583 for ( ®ui; 10u -~= 2u ~ 2u® ) { sout | ui; } 584 enum { N = 10 }; 585 for ( ®N® ) { sout | "N"; } 586 for ( ®i; N® ) { sout | i; } 587 for ( ®i; N -~ 0® ) { sout | i; } 588 const int start = 3, comp = 10, inc = 2; 582 for ( ®ui; 10u -~= 2u ~ -2u® ) { sout | ui; } 583 int start = 3, comp = 10, inc = 2; 589 584 for ( ®i; start ~ comp ~ inc + 1® ) { sout | i; } 590 585 \end{cfa} 591 586 & 592 587 \begin{cfa} 593 sout | nl; 594 sout | nl; 595 sout | nl; 596 sout | "zero" | nl; 597 sout | nl; 598 sout | nl; 599 sout | nl; 600 sout | nl; 601 sout | nl; 602 sout | nl; 603 sout | nl; 604 sout | nl; 605 sout | nl; 606 sout | nl; 607 sout | nl; 608 sout | nl; 609 sout | nl | nl; 610 611 sout | nl; 612 sout | nl; 613 sout | nl | nl; 614 615 sout | nl; 588 sout | endl; 589 sout | endl; 590 sout | endl; 591 sout | endl; 592 sout | endl; 593 sout | endl; 594 sout | endl; 595 sout | endl; 596 sout | endl; 597 sout | endl; 598 sout | endl; 599 sout | endl; 600 sout | endl; 601 sout | endl; 602 sout | endl; 603 sout | endl; 604 sout | endl; 605 606 sout | endl; 616 607 \end{cfa} 617 608 & … … 620 611 empty 621 612 empty 622 zero 613 623 614 A 624 615 A A A A A A A A A A … … 634 625 2 4 6 8 10 635 626 10 8 6 4 2 636 637 N N N N N N N N N N638 0 1 2 3 4 5 6 7 8 9639 10 9 8 7 6 5 4 3 2 1640 627 641 628 3 6 9 … … 2459 2446 int bar( int p ) { 2460 2447 ®i® += 1; §\C{// dependent on local variable}§ 2461 sout | ®i® ;2448 sout | ®i® | endl; 2462 2449 } 2463 2450 return bar; §\C{// undefined because of local dependence}§ … … 2465 2452 int main() { 2466 2453 * [int]( int ) fp = foo(); §\C{// int (* fp)( int )}§ 2467 sout | fp( 3 ) ;2454 sout | fp( 3 ) | endl; 2468 2455 } 2469 2456 \end{cfa} … … 3231 3218 \begin{cfa} 3232 3219 int x = 1, y = 2, z = 3; 3233 sout | x ®|® y ®|® z ;3220 sout | x ®|® y ®|® z | endl; 3234 3221 \end{cfa} 3235 3222 & … … 3252 3239 \begin{cfa} 3253 3240 [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ]; 3254 sout | t1 | t2 ;§\C{// print tuples}§3241 sout | t1 | t2 | endl; §\C{// print tuples}§ 3255 3242 \end{cfa} 3256 3243 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3264 3251 & 3265 3252 \begin{cfa} 3266 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) ;3253 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl; 3267 3254 \end{cfa} 3268 3255 \\ … … 3290 3277 A separator does not appear at the start or end of a line. 3291 3278 \begin{cfa}[belowskip=0pt] 3292 sout | 1 | 2 | 3 ;3279 sout | 1 | 2 | 3 | endl; 3293 3280 \end{cfa} 3294 3281 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3299 3286 A separator does not appear before or after a character literal or variable. 3300 3287 \begin{cfa} 3301 sout | '1' | '2' | '3' ;3288 sout | '1' | '2' | '3' | endl; 3302 3289 123 3303 3290 \end{cfa} … … 3306 3293 A separator does not appear before or after a null (empty) C string. 3307 3294 \begin{cfa} 3308 sout | 1 | "" | 2 | "" | 3 ;3295 sout | 1 | "" | 2 | "" | 3 | endl; 3309 3296 123 3310 3297 \end{cfa} … … 3316 3303 \begin{cfa}[mathescape=off] 3317 3304 sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x =" | 4 | "x $" | 5 | "x £" | 6 | "x ¥" 3318 | 7 | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10 ;3305 | 7 | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10 | endl; 3319 3306 \end{cfa} 3320 3307 %$ … … 3330 3317 \begin{cfa}[belowskip=0pt] 3331 3318 sout | 1 | ", x" | 2 | ". x" | 3 | "; x" | 4 | "! x" | 5 | "? x" | 6 | "% x" 3332 | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x" ;3319 | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x" | endl; 3333 3320 \end{cfa} 3334 3321 \begin{cfa}[basicstyle=\tt,showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3340 3327 A seperator does not appear before or after a C string begining/ending with the \Index*{ASCII} quote or whitespace characters: \lstinline[basicstyle=\tt,showspaces=true]@`'": \t\v\f\r\n@ 3341 3328 \begin{cfa}[belowskip=0pt] 3342 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" ;3329 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" | endl; 3343 3330 \end{cfa} 3344 3331 \begin{cfa}[basicstyle=\tt,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt] … … 3349 3336 If a space is desired before or after one of the special string start/end characters, simply insert a space. 3350 3337 \begin{cfa}[belowskip=0pt] 3351 sout | "x (§\color{red}\texttt{\textvisiblespace}§" | 1 | "§\color{red}\texttt{\textvisiblespace}§) x" | 2 | "§\color{red}\texttt{\textvisiblespace}§, x" | 3 | "§\color{red}\texttt{\textvisiblespace}§:x:§\color{red}\texttt{\textvisiblespace}§" | 4 ;3338 sout | "x (§\color{red}\texttt{\textvisiblespace}§" | 1 | "§\color{red}\texttt{\textvisiblespace}§) x" | 2 | "§\color{red}\texttt{\textvisiblespace}§, x" | 3 | "§\color{red}\texttt{\textvisiblespace}§:x:§\color{red}\texttt{\textvisiblespace}§" | 4 | endl; 3352 3339 \end{cfa} 3353 3340 \begin{cfa}[basicstyle=\tt,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt] … … 3366 3353 \begin{cfa}[mathescape=off,belowskip=0pt] 3367 3354 sepSet( sout, ", $" ); §\C{// set separator from " " to ", \$"}§ 3368 sout | 1 | 2 | 3 | " \"" | ®sep® | "\"" ;3355 sout | 1 | 2 | 3 | " \"" | ®sep® | "\"" | endl; 3369 3356 \end{cfa} 3370 3357 %$ … … 3375 3362 \begin{cfa}[belowskip=0pt] 3376 3363 sepSet( sout, " " ); §\C{// reset separator to " "}§ 3377 sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"" ;3364 sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"" | endl; 3378 3365 \end{cfa} 3379 3366 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3385 3372 strcpy( store, sepGet( sout ) ); §\C{// copy current separator}§ 3386 3373 sepSet( sout, "_" ); §\C{// change separator to underscore}§ 3387 sout | 1 | 2 | 3 ;3374 sout | 1 | 2 | 3 | endl; 3388 3375 \end{cfa} 3389 3376 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3392 3379 \begin{cfa}[belowskip=0pt] 3393 3380 sepSet( sout, store ); §\C{// change separator back to original}§ 3394 sout | 1 | 2 | 3 ;3381 sout | 1 | 2 | 3 | endl; 3395 3382 \end{cfa} 3396 3383 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3403 3390 \begin{cfa}[belowskip=0pt] 3404 3391 sepSetTuple( sout, " " ); §\C{// set tuple separator from ", " to " "}§ 3405 sout | t1 | t2 | " \"" | ®sepTuple® | "\"" ;3392 sout | t1 | t2 | " \"" | ®sepTuple® | "\"" | endl; 3406 3393 \end{cfa} 3407 3394 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3410 3397 \begin{cfa}[belowskip=0pt] 3411 3398 sepSetTuple( sout, ", " ); §\C{// reset tuple separator to ", "}§ 3412 sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"" ;3399 sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"" | endl; 3413 3400 \end{cfa} 3414 3401 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3420 3407 Manipulators \Indexc{sepDisable}\index{manipulator!sepDisable@©sepDisable©} and \Indexc{sepEnable}\index{manipulator!sepEnable@©sepEnable©} \emph{globally} toggle printing the separator, \ie the seperator is adjusted with respect to all subsequent printed items. 3421 3408 \begin{cfa}[belowskip=0pt] 3422 sout | sepDisable | 1 | 2 | 3 ;§\C{// globally turn off implicit separator}§3409 sout | sepDisable | 1 | 2 | 3 | endl; §\C{// globally turn off implicit separator}§ 3423 3410 \end{cfa} 3424 3411 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3426 3413 \end{cfa} 3427 3414 \begin{cfa}[belowskip=0pt] 3428 sout | sepEnable | 1 | 2 | 3 ; §\C{// globally turn on implicit separator}§3415 sout | sepEnable | 1 | 2 | 3 | endl; §\C{// globally turn on implicit separator}§ 3429 3416 \end{cfa} 3430 3417 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3435 3422 Manipulators \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} and \Indexc{sepOff}\index{manipulator!sepOff@©sepOff©} \emph{locally} toggle printing the separator, \ie the seperator is adjusted only with respect to the next printed item. 3436 3423 \begin{cfa}[belowskip=0pt] 3437 sout | 1 | sepOff | 2 | 3 ; §\C{// locally turn off implicit separator}§3424 sout | 1 | sepOff | 2 | 3 | endl; §\C{// locally turn off implicit separator}§ 3438 3425 \end{cfa} 3439 3426 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3441 3428 \end{cfa} 3442 3429 \begin{cfa}[belowskip=0pt] 3443 sout | sepDisable | 1 | sepOn | 2 | 3 ; §\C{// locally turn on implicit separator}§3430 sout | sepDisable | 1 | sepOn | 2 | 3 | endl; §\C{// locally turn on implicit separator}§ 3444 3431 \end{cfa} 3445 3432 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3448 3435 The tuple separator also responses to being turned on and off. 3449 3436 \begin{cfa}[belowskip=0pt] 3450 sout | t1 | sepOff | t2 ; §\C{// locally turn on/off implicit separator}§3437 sout | t1 | sepOff | t2 | endl; §\C{// locally turn on/off implicit separator}§ 3451 3438 \end{cfa} 3452 3439 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3456 3443 use ©sep© to accomplish this functionality. 3457 3444 \begin{cfa}[belowskip=0pt] 3458 sout | sepOn | 1 | 2 | 3 | sepOn ; §\C{// sepOn does nothing at start/end of line}§3445 sout | sepOn | 1 | 2 | 3 | sepOn | endl ; §\C{// sepOn does nothing at start/end of line}§ 3459 3446 \end{cfa} 3460 3447 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3462 3449 \end{cfa} 3463 3450 \begin{cfa}[belowskip=0pt] 3464 sout | sep | 1 | 2 | 3 | sep ; §\C{// use sep to print separator at start/end of line}§3451 sout | sep | 1 | 2 | 3 | sep | endl ; §\C{// use sep to print separator at start/end of line}§ 3465 3452 \end{cfa} 3466 3453 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3475 3462 int main( void ) { 3476 3463 int x = 1, y = 2, z = 3; 3477 sout | x | y | z ;3464 sout | x | y | z | endl; 3478 3465 [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ]; 3479 sout | t1 | t2 ; // print tuples3480 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) ;3481 sout | 1 | 2 | 3 ;3482 sout | '1' | '2' | '3' ;3483 sout | 1 | "" | 2 | "" | 3 ;3466 sout | t1 | t2 | endl; // print tuples 3467 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl; 3468 sout | 1 | 2 | 3 | endl; 3469 sout | '1' | '2' | '3' | endl; 3470 sout | 1 | "" | 2 | "" | 3 | endl; 3484 3471 sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x =" | 4 | "x $" | 5 | "x £" | 6 | "x ¥" 3485 | 7 | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10 ;3472 | 7 | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10 | endl; 3486 3473 sout | 1 | ", x" | 2 | ". x" | 3 | "; x" | 4 | "! x" | 5 | "? x" | 6 | "% x" 3487 | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x" ;3488 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" ;3489 sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 ;3474 | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x" | endl; 3475 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" | endl; 3476 sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl; 3490 3477 3491 3478 sepSet( sout, ", $" ); // set separator from " " to ", $" 3492 sout | 1 | 2 | 3 | " \"" | sep | "\"" ;3479 sout | 1 | 2 | 3 | " \"" | sep | "\"" | endl; 3493 3480 sepSet( sout, " " ); // reset separator to " " 3494 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" ;3481 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl; 3495 3482 3496 3483 char store[sepSize]; 3497 3484 strcpy( store, sepGet( sout ) ); 3498 3485 sepSet( sout, "_" ); 3499 sout | 1 | 2 | 3 ;3486 sout | 1 | 2 | 3 | endl; 3500 3487 sepSet( sout, store ); 3501 sout | 1 | 2 | 3 ;3488 sout | 1 | 2 | 3 | endl; 3502 3489 3503 3490 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " 3504 sout | t1 | t2 | " \"" | sepTuple | "\"" ;3491 sout | t1 | t2 | " \"" | sepTuple | "\"" | endl; 3505 3492 sepSetTuple( sout, ", " ); // reset tuple separator to ", " 3506 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" ;3507 3508 sout | sepDisable | 1 | 2 | 3 ; // globally turn off implicit separator3509 sout | sepEnable | 1 | 2 | 3 ; // globally turn on implicit separator3510 3511 sout | 1 | sepOff | 2 | 3 ; // locally turn on implicit separator3512 sout | sepDisable | 1 | sepOn | 2 | 3 ; // globally turn off implicit separator3493 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl; 3494 3495 sout | sepDisable | 1 | 2 | 3 | endl; // globally turn off implicit separator 3496 sout | sepEnable | 1 | 2 | 3 | endl; // globally turn on implicit separator 3497 3498 sout | 1 | sepOff | 2 | 3 | endl; // locally turn on implicit separator 3499 sout | sepDisable | 1 | sepOn | 2 | 3 | endl; // globally turn off implicit separator 3513 3500 sout | sepEnable; 3514 sout | t1 | sepOff | t2 ; // locally turn on/off implicit separator3515 3516 sout | sepOn | 1 | 2 | 3 | sepOn ; // sepOn does nothing at start/end of line3517 sout | sep | 1 | 2 | 3 | sep ; // use sep to print separator at start/end of line3501 sout | t1 | sepOff | t2 | endl; // locally turn on/off implicit separator 3502 3503 sout | sepOn | 1 | 2 | 3 | sepOn | endl ; // sepOn does nothing at start/end of line 3504 sout | sep | 1 | 2 | 3 | sep | endl ; // use sep to print separator at start/end of line 3518 3505 } 3519 3506 … … 4180 4167 Fibonacci f1, f2; 4181 4168 for ( int i = 1; i <= 10; i += 1 ) { 4182 sout | next( &f1 ) | ' ' | next( &f2 ) ;4169 sout | next( &f1 ) | ' ' | next( &f2 ) | endl; 4183 4170 } // for 4184 4171 } … … 4246 4233 MyThread f[4]; 4247 4234 } 4248 sout | global.value ;4235 sout | global.value | endl; 4249 4236 } 4250 4237 \end{cfa} … … 4324 4311 void main( First * this ) { 4325 4312 for ( int i = 0; i < 10; i += 1 ) { 4326 sout | "First : Suspend No." | i + 1 ;4313 sout | "First : Suspend No." | i + 1 | endl; 4327 4314 yield(); 4328 4315 } … … 4333 4320 wait( this->lock ); 4334 4321 for ( int i = 0; i < 10; i += 1 ) { 4335 sout | "Second : Suspend No." | i + 1 ;4322 sout | "Second : Suspend No." | i + 1 | endl; 4336 4323 yield(); 4337 4324 } … … 4340 4327 int main( void ) { 4341 4328 signal_once lock; 4342 sout | "User main begin" ;4329 sout | "User main begin" | endl; 4343 4330 { 4344 4331 processor p; … … 4348 4335 } 4349 4336 } 4350 sout | "User main end" ;4337 sout | "User main end" | endl; 4351 4338 } 4352 4339 \end{cfa} … … 5045 5032 void ?{}( Line * l ) { 5046 5033 l->lnth = 0.0; 5047 sout | "default" ;5034 sout | "default" | endl; 5048 5035 } 5049 5036 … … 5052 5039 void ?{}( Line * l, float lnth ) { 5053 5040 l->lnth = lnth; 5054 sout | "lnth" | l->lnth ;5041 sout | "lnth" | l->lnth | endl; 5055 5042 5056 5043 } … … 5058 5045 // destructor 5059 5046 void ^?() { 5060 sout | "destroyed" ;5047 sout | "destroyed" | endl; 5061 5048 l.lnth = 0.0; 5062 5049 } … … 5804 5791 In particular, output of ©char© variable now print a character rather than the decimal ASCII value of the character. 5805 5792 \begin{cfa} 5806 sout | 'x' | " " | (int)'x' ;5793 sout | 'x' | " " | (int)'x' | endl; 5807 5794 x 120 5808 5795 \end{cfa} … … 7034 7021 #include <gmp>§\indexc{gmp}§ 7035 7022 int main( void ) { 7036 sout | "Factorial Numbers" ;7023 sout | "Factorial Numbers" | endl; 7037 7024 Int fact = 1; 7038 7025 7039 sout | 0 | fact ;7026 sout | 0 | fact | endl; 7040 7027 for ( unsigned int i = 1; i <= 40; i += 1 ) { 7041 7028 fact *= i; 7042 sout | i | fact ;7029 sout | i | fact | endl; 7043 7030 } 7044 7031 }
Note:
See TracChangeset
for help on using the changeset viewer.