可以创建完数组后,for循环整个数组,将奇数的元素删除。srand((unsigned)time(NULL)); //用时间做种,每次产生随机数不一样int number = rand() % 100; //产生0-100的随机数