//
// 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.c --
//
// Author           : Peter A. Buhr
// Created On       : Sat Aug 26 10:13:11 2017
// Last Modified By : Peter A. Buhr
// Last Modified On : Wed Jun  6 17:15:09 2018
// Update Count     : 21
//

#include <fstream>

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.c" //
// End: //
