其他分享
首页 > 其他分享> > 魔术

魔术

作者:互联网

魔术

通过 随机数 字符型 实现

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>

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

 

标签:gu,main,int,魔术,&&,include
来源: https://www.cnblogs.com/p201821440039/p/10645474.html