C语言随机数生成器,,怎么通过这个改写姓名生成器
程序代码:
#include<stdio.h> #include<stdlib.h> #include<time.h> #include<conio.h> #include<windows.h> int main(void) { int sp1_number=8; //press key A to show number int sp2_number=24; //press key S to show number int sp3_number=32; //press key F to show number int sp4_number=44; //press key Q to show number int sp5_number=51; //press key W to show number int sp6_number=47; //press key E to show number int sp7_number=37; //press key R to show number int sp8_number=28; //press key Z to show number int sp9_number=19; //press key X to show number int sp10_number=10; //press key C to show number srand(time(NULL)*time(NULL)*time(NULL)); while(1) { char c=getch(); if(c!='a'&&c!='s'&&c!='f'&&c!='q'&&c!='w'&&c!='e'&&c!='r'&&c!='z'&&c!='x'&&c!='c') { int rd=rand()%60+1; system("cls"); printf("\n\n\n "); printf("%d",rd); } else if(c=='a') { system("cls"); printf("\n\n\n "); printf("%d",sp1_number); } else if(c=='s') { system("cls"); printf("\n\n\n "); printf("%d",sp2_number); } else if (c=='f') { system("cls"); printf("\n\n\n "); printf("%d",sp3_number); } else if (c=='q') { system("cls"); printf("\n\n\n "); printf("%d",sp4_number); } else if (c=='w') { system("cls"); printf("\n\n\n "); printf("%d",sp5_number); } else if (c=='e') { system("cls"); printf("\n\n\n "); printf("%d",sp6_number); } else if (c=='r') { system("cls"); printf("\n\n\n "); printf("%d",sp7_number); } else if (c=='z') { system("cls"); printf("\n\n\n "); printf("%d",sp8_number); } else if (c=='x') { system("cls"); printf("\n\n\n "); printf("%d",sp9_number); } else if (c=='c') { system("cls"); printf("\n\n\n "); printf("%d",sp10_number); } } return 0; }
这是我写的可暗中控制的随机数生成,,求怎么改写随机姓名抽取呢?,即使不可控也行。