Changeset cdbab55 for tests/coroutine/fibonacci.c
- Timestamp:
- Aug 21, 2018, 2:24:29 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 2a6292d
- Parents:
- 2b79a70 (diff), efa8b6a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
tests/coroutine/fibonacci.c (moved) (moved from src/tests/coroutine/fibonacci.c ) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/coroutine/fibonacci.c
r2b79a70 rcdbab55 6 6 // 7 7 // fibonacci.c -- 3-state finite-state machine 8 9 8 // 10 9 // Author : Thierry Delisle 11 10 // Created On : Thu Jun 8 07:29:37 2017 12 11 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Apr 27 08:55:31201814 // Update Count : 1912 // Last Modified On : Sat Aug 18 11:21:58 2018 13 // Update Count : 24 15 14 // 16 15 17 #include <fstream >18 #include <coroutine >16 #include <fstream.hfa> 17 #include <coroutine.hfa> 19 18 20 19 coroutine Fibonacci { int fn; }; // used for communication … … 26 25 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 27 26 suspend(); // restart last resume 28 for ( ;;) {27 for () { 29 28 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 30 29 suspend(); // restart last resume … … 39 38 int main() { 40 39 Fibonacci f1, f2; 41 for ( int i = 1; i <= 10; i += 1 ) {40 for ( 10 ) { // print N Fibonacci values 42 41 sout | next( f1 ) | next( f2 ) | endl; 43 42 } // for
Note:
See TracChangeset
for help on using the changeset viewer.