1/* BEGIN LICENSE BLOCK 2 * Version: CMPL 1.1 3 * 4 * The contents of this file are subject to the Cisco-style Mozilla Public 5 * License Version 1.1 (the "License"); you may not use this file except 6 * in compliance with the License. You may obtain a copy of the License 7 * at www.eclipse-clp.org/license. 8 * 9 * Software distributed under the License is distributed on an "AS IS" 10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11 * the License for the specific language governing rights and limitations 12 * under the License. 13 * 14 * The Original Code is The ECLiPSe Constraint Logic Programming System. 15 * The Initial Developer of the Original Code is Cisco Systems, Inc. 16 * Portions created by the Initial Developer are 17 * Copyright (C) 1997-2006 Cisco Systems, Inc. All Rights Reserved. 18 * 19 * Contributor(s): 20 * 21 * END LICENSE BLOCK */ 22 23 24/* 25 * ECLiPSe LIBRARY MODULE 26 * 27 * $Id: eg_cc_sendmore.cc,v 1.2 2012/02/25 13:47:56 jschimpf Exp $ 28 * 29 * 30 * IDENTIFICATION: eg.cc 31 * 32 * AUTHOR: Joachim Schimpf 33 * AUTHOR: Stefano Novello 34 * 35 * CONTENTS: name/arity 36 * 37 * DESCRIPTION: 38 */ 39 40#include "eclipseclass.h" 41 42enum {S,E,N,D,M,O,R,Y}; 43 44int 45main() 46{ 47 ec_init(); 48 post_goal("lib(fd)"); 49 50 EC_refs X(8); 51 EC_ref DigitList; 52 DigitList = list(X); 53 54 post_goal(term(EC_functor("::",2),DigitList, 55 term( EC_functor("..",2),0,9))); 56 57 post_goal(term(EC_functor("alldistinct",1),DigitList)); 58 post_goal(term(EC_functor("##",2),0,X[S])); 59 post_goal(term(EC_functor("##",2),0,X[M])); 60 post_goal(term(EC_functor("#=",2), 61 1000 * X[S] + 100 * X[E] + 10 * X[N] + X[D] 62 + 1000 * X[M] + 100 * X[O] + 10 * X[R] + X[E] , 63 10000 * X[M] + 1000 * X[O] + 100 * X[N] + 10 * X[E] + X[Y] )); 64 post_goal(term(EC_functor("labeling",1),DigitList)); 65 post_goal(term(EC_functor("writeln",1),DigitList)); 66 EC_resume(); 67} 68 69 70