// // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // ifwhileCtl.cfa -- // // Author : Peter A. Buhr // Created On : Sat Aug 26 10:13:11 2017 // Last Modified By : Peter A. Buhr // Last Modified On : Tue Nov 6 17:57:07 2018 // Update Count : 22 // #include int f( int r ) { return r; } int main( void ) { int x = 4, y = 3; if ( int x = 1 ) { sout | "x != 0 correct" | endl; } else { sout | "x == 0 incorrect" | endl; } // if if ( int x = 4, y = 0 ) { sout | "x != 0 && y != 0 incorrect" | endl; } else if ( int x = 4, y = 1 ) { sout | "x != 0 && y != 0 correct" | endl; } else { sout | "x == 0 || y == 0 incorrect" | endl; } // if if ( int x = 5, y = f( x ); x == y ) { sout | "x == y correct" | endl; } else { sout | "x != y incorrect" | endl; } // if if ( struct S { int i; } s = { 3 }; s.i < 4 ) { S s1; sout | "s.i < 4 correct" | endl; } else { S s1; sout | "s.i >= 4 incorrect" | endl; } // if while ( int x = 1 ) { sout | "x != 0 correct" | endl; break; } // while while ( int x = 4, y = 0 ) { sout | "x != 0 && y != 0 incorrect" | endl; } // while while ( int x = 5, y = f( x ); x == y ) { sout | "x == y correct" | endl; break; } // while while ( struct S { int i; } s = { 3 }; s.i < 4 ) { S s1; sout | "s.i < 4 correct" | endl; break; } // while } // main // Local Variables: // // tab-width: 4 // // compile-command: "cfa ifwhileCtl.cfa" // // End: //