示例#1
0
static void
draw_scene(void)
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glPushMatrix();
  glTranslatef(-1.7, 0.0, 0.0);
  cubes(deltax, deltay, WIREFRAME);
  glPopMatrix();

  glPushMatrix();
  cubes(deltax, deltay, HIDDEN_LINE);
  glPopMatrix();

  glPushMatrix();
  glTranslatef(1.7, 0.0, 0.0);

  switch(version) {
#ifdef GL_VERSION_1_1
  case MODE_11:
    glEnable(GL_POLYGON_OFFSET_FILL);
    break;
#endif
#ifdef GL_EXT_polygon_offset
  case MODE_EXT:
    glEnable(GL_POLYGON_OFFSET_EXT);
    break;
#endif
  }

  cubes(deltax, deltay, HIDDEN_LINE);

  switch(version) {
#ifdef GL_VERSION_1_1
  case MODE_11:
    glDisable(GL_POLYGON_OFFSET_FILL);
    break;
#endif
#ifdef GL_EXT_polygon_offset
  case MODE_EXT:
    glDisable(GL_POLYGON_OFFSET_EXT);
    break;
#endif
  }

  glPopMatrix();

  glutSwapBuffers();
}
示例#2
0
main ()
{
	int s[4];
	int x[500];
	register i;

	LOOP (s[0])
		LOOP (s[1])
			LOOP (s[2])
				LOOP (s[3])
					x [cubes (s)] ++;
	for (i=0; i<500; i++)
		if (x[i])
			printf ("%d\t%d\n", i, x[i]);
	exit (0);
}
示例#3
0
int main () {
    count_words();

    auto cube = cubes(-5, 10); // move construct returned value
    std::cout << cube.at(-2) << '\n'; // -8
    std::cout << cube.at(5) << '\n';  // 125
    const int n = 30;
    try {
        std::cout << cube.at(n) << '\n'; // 30 is not in the Map
    } catch (std::out_of_range) {
        std::cout << n << " not in cubes range\n";
    }

    // constructors and assignment examples:
    // initializer_list example
    cs540::Map<int, double> int_double_map {{1, 1.0}, {3, 5.67}, {13, 6.9}};

    // must support copy construction
    cs540::Map<int, double> copy_example{int_double_map};

    // must support move construction
    cs540::Map<int, double> move_example {std::move(int_double_map)};

    cs540::Map<int, double> assign_example;
    // must support copy assignment
    assign_example = copy_example;
    // must support move assignment
    assign_example = std::move(move_example);

    // moved-from object must still support assignment
    move_example = copy_example;

    move_insert();
    access_by_key();
    stress(10000);

    return 0;
}
示例#4
0
int step ()
{
	int sum=0, amount=0, beg=1, k;

	for (;;) {
		if (beg) {
			for (k=0; k<NCUBE; k++)
				cube[k] = 1;
			beg = 0;
		} else if (!yes ())
			return (sum);
		sum += amount = cubes (sum);
		if (! amount) {
			printf ("\7Все пропало.\n");
			return (0);
		}
		for (k=0; k<NCUBE; k++)
			if (cube[k]) break;
		if (k >= NCUBE) {
			printf ("\7Призовая игра!\n");
			beg = 1;
		}
	}
}
void BrowserDocumentation::defineCube(CPCube cube)
{
	vector<CPCube> cubes(1, cube);
	defineCubes(&cubes);
}