搜索
查看: 749|回复: 5
打印 上一主题 下一主题

怎么从1打印到100再从100打印到1啊?

[复制链接]
跳转到指定楼层
楼主
发表于 2014-7-3 12:53:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
5啊哈币
???怎么从1打印到100再从100打印到1啊?

最佳答案

查看完整内容

[mw_shl_code=c,true]/*给你一个while语句的版本,么么达~~!*/ #include #include void HideCursor(); int main(void) { int a,b; HideCursor(); a=1; while(a=1) { printf("%d\n",b--); Sleep(1000); system("CLS"); } return 0; } void HideCursor() { CONSOLE_CURSOR_INFO cursor_info = {1, 0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); }[ ...
沙发
发表于 2014-7-3 12:53:25 | 只看该作者
[mw_shl_code=c,true]/*给你一个while语句的版本,么么达~~!*/

#include<stdio.h>
#include<windows.h>

void HideCursor();

int main(void)
{
        int a,b;
       
        HideCursor();
        a=1;
        while(a<=100)       
        {
                printf("%d\n",a++);
                Sleep(1000);
                system("CLS");
        }
        b=99;
        while(b>=1)
        {
                printf("%d\n",b--);
                Sleep(1000);
                system("CLS");
        }
       
        return 0;
}

void HideCursor()
{
        CONSOLE_CURSOR_INFO cursor_info = {1, 0};
        SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}[/mw_shl_code]

点评

Good!!!すごい!!!  发表于 2014-7-4 21:15
板凳
发表于 2014-7-3 13:12:55 | 只看该作者
[mw_shl_code=c,true]#include <stdio.h>
#include <stdlib.h>
int main()
{
        int a;
    for(a=1;a<=100;++a)
                printf("%d\n",a);
    for(a=100;a>=1;--a)
                printf("%d\n",a);
        system("pause");
        return 0;
}
[/mw_shl_code]
地板
发表于 2014-7-4 09:55:46 | 只看该作者
李掌柜 发表于 2014-7-3 14:10
[mw_shl_code=c,true]/*给你一个while语句的版本,么么达~~!*/

#include

掌柜的31到35行写的是啥。。。
5#
发表于 2014-7-4 11:07:04 | 只看该作者
Dsp 发表于 2014-7-4 09:55
掌柜的31到35行写的是啥。。。

隐藏光标啊,你想呀,输出的时候光标一闪一闪的多烦人呀
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

广播台
特别关注
快速回复 返回顶部 返回列表