Beispiel #1
0
void main(){

	int m,n,dadosdef,dadosat;
	int r,t,wi,hi;
	int x[3],y[3];
	char op;

   do{
        n=0;
	m=0;
	r=0;
	n=0;
	t=0;
	wi=0;
	for(hi=0;hi<3;hi++){
		x[hi]=0;
		y[hi]=0;
	}


	clrscr();
	dadosat=3;
	dadosdef=3;
	randomize();

	for(m=0;m<dadosat;m++){
		r = (rand() % 6) + 1;
		switch (m){
		  case 0: x[0]=r;break;
		  case 1: case1(&x[0],&x[1],r);break;
		  case 2: case2(&x[0],&x[1],&x[2],r);break;
		  default:printf("HAY ERROR EN CALCULO DE ATAQUE");
		  }
		r=0;
        }
	randomize();

	for(n=0;n<dadosdef;n++){

		t = (rand() % 6) + 1;
		switch (n){
		  case 0: y[0]=t;break;
		  case 1:case1(&y[0],&y[1],t);break;
		  case 2:case2(&y[0],&y[1],&y[2],t);break;
		  default:printf("HAY ERROR EN CALCULO DE DEFENSA");
		  }
		t=0;

	}
	for(wi=0;wi<3;wi++){
		printf("\n\n%d\t\t%d",x[wi],y[wi]);
	}
	op=getch();
   }while(op != 's');
}
Beispiel #2
0
void readFcc()
{
   std::cout << "-- Mockup" << std::endl;
   case1("fccMockup.root");
   case2("fccMockup.root");
   case3("fccMockup.root");
   std::cout << "-- Skim" << std::endl;
   case1("fccSkim.root");
   case2("fccSkim.root");
   case3("fccSkim.root");
}
Beispiel #3
0
int main()
{
	adam_init();
	
	sexpression_t* svoid;
	assert(NULL != sexp_parse("void", &svoid));
	tvoid = dalvik_type_from_sexp(svoid);
	sexp_free(svoid);
	assert(NULL != tvoid);
	/* load package */
	dalvik_loader_from_directory("test/cases/block_analyzer");
	
	
	/* run test cases */
	case1();

	case2();

	case3();

	dalvik_type_free(tvoid);
	/* finalize */
	adam_finalize();
	return 0;
}
Beispiel #4
0
void main(void)
{

	switch(1) {
        case CASE1: case1(); break;
        case CASE2: case2(); break;
	}
}
Beispiel #5
0
 void
 coverQuantisationCornerCases()
   {
     // origin at lower end of the time range
     FixedFrameQuantiser case1 (1, Time::MIN);
     CHECK (secs(0)            == case1.gridAlign(Time::MIN  ));
     CHECK (secs(0)            == case1.gridAlign(Time::MIN +TimeValue(1) ));
     CHECK (secs(1)            == case1.gridAlign(Time::MIN +secs(1) ));
     CHECK (Time::MAX -secs(1) >  case1.gridAlign( secs(-1)  ));
     CHECK (Time::MAX -secs(1) <= case1.gridAlign( secs (0)  ));
     CHECK (Time::MAX          >  case1.gridAlign( secs (0)  ));
     CHECK (Time::MAX          == case1.gridAlign( secs(+1)  ));
     CHECK (Time::MAX          == case1.gridAlign( secs(+2)  ));
     
     // origin at upper end of the time range
     FixedFrameQuantiser case2 (1, Time::MAX);
     CHECK (secs( 0)           == case2.gridAlign(Time::MAX  ));
     CHECK (secs(-1)           == case2.gridAlign(Time::MAX -TimeValue(1) ));  // note: next lower frame
     CHECK (secs(-1)           == case2.gridAlign(Time::MAX -secs(1) ));      //        i.e. the same as a whole frame down
     CHECK (Time::MIN +secs(1) <  case2.gridAlign( secs(+2)  ));
     CHECK (Time::MIN +secs(1) >= case2.gridAlign( secs(+1)  ));
     CHECK (Time::MIN          <  case2.gridAlign( secs(+1)  ));
     CHECK (Time::MIN          == case2.gridAlign( secs( 0)  ));          //      note: because of downward truncating,
     CHECK (Time::MIN          == case2.gridAlign( secs(-1)  ));         //             resulting values will already exceed
     CHECK (Time::MIN          == case2.gridAlign( secs(-2)  ));        //              allowed range and thus will be clipped
     
     // maximum frame size is half the time range
     Duration hugeFrame(Time::MAX);
     FixedFrameQuantiser case3 (hugeFrame);
     CHECK (Time::MIN          == case3.gridAlign(Time::MIN  ));
     CHECK (Time::MIN          == case3.gridAlign(Time::MIN +TimeValue(1) ));
     CHECK (Time::MIN          == case3.gridAlign( secs(-1)  ));
     CHECK (TimeValue(0)       == case3.gridAlign( secs( 0)  ));
     CHECK (TimeValue(0)       == case3.gridAlign( secs(+1)  ));
     CHECK (TimeValue(0)       == case3.gridAlign(Time::MAX -TimeValue(1) ));
     CHECK (Time::MAX          == case3.gridAlign(Time::MAX  ));
     
     // now displacing this grid by +1sec....
     FixedFrameQuantiser case4 (hugeFrame, secs(1));
     CHECK (Time::MIN          == case4.gridAlign(Time::MIN  ));
     CHECK (Time::MIN          == case4.gridAlign(Time::MIN +TimeValue(1) ));  // clipped...
     CHECK (Time::MIN          == case4.gridAlign(Time::MIN +secs(1) ));      //  but now exact (unclipped)
     CHECK (Time::MIN          == case4.gridAlign( secs(-1)  ));
     CHECK (Time::MIN          == case4.gridAlign( secs( 0)  ));
     CHECK (TimeValue(0)       == case4.gridAlign( secs(+1)  ));           //.....now exactly the frame number zero
     CHECK (TimeValue(0)       == case4.gridAlign(Time::MAX -TimeValue(1) ));
     CHECK (TimeValue(0)       == case4.gridAlign(Time::MAX  ));         //.......still truncated down to frame #0
     
     // larger frames aren't possible
     Duration not_really_larger(secs(10000) + hugeFrame);
     CHECK (hugeFrame == not_really_larger);
     
     // frame sizes below the time micro grid get trapped
     long subAtomic = 2*GAVL_TIME_SCALE;                           // too small for this universe...
     VERIFY_ERROR (BOTTOM_VALUE, FixedFrameQuantiser quark(subAtomic) );
     VERIFY_ERROR (BOTTOM_VALUE, FixedFrameQuantiser quark(Duration (FSecs (1,subAtomic))) );
   }
int _tmain(int argc, _TCHAR* argv[])
{
	int command = 1;
	while(command){
		scanf_s("%d", &command);
		switch (command)
		{
		case 0: {
					command = 0;

				}
		case 1: {
					printf("%s", "Case 1\n");
					case1();
					break;
				}
		case 2: {
					printf("%s", "Case 2\n");
					case2();
					break;
				}
		case 3: {
					printf("%s", "Case 3\n");
					case3();
					break;
				}
		case 4: {
					printf("%s", "Case 4\n");
					case4();
					break;
				}
		case 5:{
					printf("%s", "Case 5\n");
					case5();
					break;
			   }
		default:
			break;
		}
	}
	/*VirtualAddress a = (VirtualAddress) malloc(sizeof(char));
	VirtualAddress b = (VirtualAddress) malloc(sizeof(char));
	VirtualAddress c = (VirtualAddress) malloc(sizeof(char));
	VirtualAddress d = (VirtualAddress) malloc(sizeof(char));
	_init(2, 1024);

	_malloc(&a, 512);
	_malloc(&b, 256);
	_malloc(&c, 128);
	_malloc(&d, 64);
	_free(c);
	_free(b);
	printf("%d\n", 11);*/
	_getch();
	return 0;
}
Beispiel #7
0
int ans()
{
   int nosolution(),case0(),case1(),case2();
   void turn();
   if (nosolution())
      return(-1);
   if (case0())
      return(0);
   if (case1())
      return(1);
   turn();
   if (case1())
      return(1);
   if (case2())
      return(2);
   turn();
   if (case2())
      return(2);
   return(3);
}
Beispiel #8
0
int main() {
  int choix;
  char *nf=(char*)malloc(sizeof(char)*128);
 
  printf("Bienvenu\n");
  printf("Veuillez saisir le nom du fichier .cha à lire\n");
  scanf("%s",nf);

  while(1) {
    printf("1 : Pour créer une figure avec une liste\n");
    printf("2 : Pour créer un réseau simple\n");
    printf("3 : Pour créer un réseau avec table de hachage\n");
    printf("4 : Pour créer un réseau avec ABRe\n");
    printf("5 : Pour créer un fichier des temps cpu de l'instance\n");
    printf("6 : Pour créer le fichier des temps cpu de l'ensemble\n");
    printf("7 : Quitter\n");

    scanf("%d",&choix);


    switch(choix) {
    case 1 :
      case1(nf);
      break;

    case 2 :
      case2(nf);
      break;

    case 3 :
      case3(nf);
      break;

    case 4 :
      case4(nf);
      break;

    case 5 :
      case5(nf);
      break;

    case 6 :
      case6(nf);
      break;


    default :
      return 0;
    }
  }
}
static void restoreBalance(TLDNode *node, TLDList *tld)
{
    TLDNode *x = findImbalanced(node->parent);
    if (x != NULL)
    {
        if (case1(x))
            LLRodation(x, tld);
        else if (case2(x))
            LRRotation(x, tld);
        else if (case3(x))
            RLRotation(x, tld);
        else if (case4(x))
            RRRotation(x, tld);
    }
}
int main()
{
	float a,b,c,m;
	printf("请输入三个数(用逗号连接):");
	scanf("%f,%f,%f",&a,&b,&c);
	printf("等式为:%f*x*x+%f*x+%f=0\n",a,b,c);
	m=b*b-4*a*c;
	if(m>0)
		case1(a,b,c);
	else if(m==0)
		case2(a,b,c);
	else
		case3(a,b,c);
	return 0;
}
Beispiel #11
0
void solve()
{
     int cur = 0;
     long long ans = 0;
     hm[cur].init();hm[cur].push(0,1);
     for(int i = 1;i<=n;++i)
      for(int j = 1;j<=m;++j)
      {
              hm[cur^1].init();
              if(maze[i][j]) case1(i,j,cur);
              else case2(i,j,cur);
              cur^=1;
      }
     for(int i = 0;i<hm[cur].size;++i)
      ans += hm[cur].f[i];
     printf("There are %I64d ways to eat the trees.\n",ans);
}
Beispiel #12
0
int
foo (enum CASE_VALUES *index)
{
    switch (*index)
    {
    case CASE0:
        return case0 ();
    case CASE1:
        return case1 ();
    case CASE2:
        return case2 ();
    case CASE3:
        return case3 ();
    case CASE4:
        return case4 ();
    }

    return 0;
}
Beispiel #13
0
void testBug(void)
{
  ASSERT(case1());
  ASSERT(case2());
  ASSERT(case3());
}
Beispiel #14
0
structCarros() {

    do {
        for (i = 0; i < 5; i++) {

            
            cadastraCarros();
           printf("\nDIGITE 1 PARA CADASTRAR UM CARRO.. ");
           printf("\nDIGITE -1 PARA ACESSAR O MENU");
            scanf("%d", &flag2);
           if(flag2 == -1)
               break;
             
        }
        
    } while(flag2 != -1 && i < 5);

    do {
        menuCarros();
        switch (opc2) {

            case 1:
                flag2 = 1;
                do {
                    case1(diesel);
                    printf("\n\nDIGITE -1 PARA VOLTAR AO MENU.. ");
                    scanf("%d", &flag2);
                } while (flag2 != -1);
                break;
            case 2:
                flag2 = 1;
                do {
                    case2();
                    printf("\n\nDIGITE -1 PARA VOLTAR AO MENU.. ");
                    scanf("%d", &flag2);
                }while (flag2 != -1);
                break;
            case 3:
                flag2 = 1;
                do {
                    case3();
                    printf("\n\nDIGITE -1 PARA VOLTAR AO MENU.. ");
                    scanf("%d", &flag2);
                }while (flag2 != -1);
                break;
            case 4:
                flag2 = 1;
                do {
                    case4(chasi);
                    printf("\n\nDIGITE -1 PARA VOLTAR AO MENU.. ");
                    scanf("%d", &flag2);
                }while (flag2 != -1);
                break;
            case 0:
                flag2 = 0;
                exit(0);
                break;
        }
    } while (flag2 != 0);

}