当前位置: 首页>>代码示例>>C++>>正文


C++ Turtle::sleep方法代码示例

本文整理汇总了C++中Turtle::sleep方法的典型用法代码示例。如果您正苦于以下问题:C++ Turtle::sleep方法的具体用法?C++ Turtle::sleep怎么用?C++ Turtle::sleep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Turtle的用法示例。


在下文中一共展示了Turtle::sleep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ccc_win_main

/**
    The main function begins execution of the program.
*/
int ccc_win_main() {
    Turtle myrtle;
    double size = 3;

    myrtle.moveTo(5 - size / 2, -9); // bottom of drawing area
    myrtle.setHeading(90);
    for (int i = 3; i < 10; i++) {
        drawPolygon(myrtle, size, i);
    }

    myrtle.moveTo(-4 + size / 2, 1);
    myrtle.setHeading(-18);
    drawStar(myrtle, size, 5);

    myrtle.moveTo(-5, -5); // center of drawing area
    myrtle.setHeading(0);
    drawRosette(myrtle, size, 40);

    myrtle.moveTo(5, 5); // center of drawing area
    myrtle.setHeading(90);
    drawSpiral(myrtle, .01);

    usleep(2000000);
    cwin.clear();
    myrtle.moveTo(0, -9); // start of drawing area
    myrtle.setHeading(0);
    tree(myrtle, 10, 7, 60, .6);

    usleep(2000000);
    cwin.clear();
    myrtle.moveTo(-9, -9); // start of drawing area
    myrtle.setHeading(90);
    koch(myrtle, 5, .25, 80);

    usleep(2000000);
    cwin.clear();
    myrtle.moveTo(4, -8); // start of drawing area
    myrtle.setHeading(0);
    kochSnowflake(myrtle, 5, .05);

    myrtle.sleep(2000);
    myrtle.clear();
    string input = myrtle.getString("Enter a message: ");
    int num1 = myrtle.getInt("Enter an integer number: ");
    double num2 = myrtle.getDouble("Enter a double number: ");
    myrtle.moveTo("Click mouse to display the message");
    myrtle.print(input);
    myrtle.moveTo("Click mouse to display the integer number");
    myrtle.print(num1);
    myrtle.moveTo("Click mouse to display the double number");
    myrtle.print(num2);
    myrtle.moveTo("Click mouse to display a square");
    myrtle.setHeading(0);
    myrtle.right(90);
    myrtle.forward(5);
    myrtle.right(90);
    myrtle.forward(5);
    myrtle.right(90);
    myrtle.forward(5);
    myrtle.right(90);
    myrtle.forward(5);
}
开发者ID:obiejuan,项目名称:cabrillo-college,代码行数:65,代码来源:turtletest.cpp


注:本文中的Turtle::sleep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。