c语言作业——趣味测试

#include "stdio.h"
#include "stdlib.h"
#include "time.h"
int main()
{
    int i;
    char a, b;
    srand((unsigned)time(NULL));
    a = 6;
    b = rand() % 6 + 1;
    for (i = 1; i <= 100; i++)
    {
        a = rand() % 31 + 1;
        if (a >= 7 && a <= 13)
        {
            a = 17;
        }
        if (i % 9 == 0)
        {
            printf("%d.%c\t", i, b);
        }
        else
        {
            printf("%d.%c\t", i, a);
        }
        if (i % 5 == 0)
        {
            printf("\n");
        }
    }
    getchar();
    printf("the icon you guess is:\n");
    for (i = 1; i <= 10; i++)
    {
        printf("%c ", b);
    }
    printf("\n");
    return 0;
}

 

posted @ 2019-03-24 22:09  GloriaB  阅读(206)  评论(0编辑  收藏  举报