int main() { int R, V[10], S[30], D[30], l; inputArray(V); l = inputString(S); encrypting(V, S, D, l); outputArray(D, l); R = decrypting(D, V, l); return 0; }
int main (void) { int i; int arr[LEN]; inputArray(arr,LEN); for (i=0; i<LEN;i++) { printf("%d\n",arr[i]); } return 0; }
int main() { int array[SIZE], sizeOfPart, n; char answer; printf("Enter the size of array (0 < size <= %d): ", SIZE); scanf("%d", &sizeOfPart); if(sizeOfPart > 0 && sizeOfPart <= SIZE) { printf("Do you want to generate random numbers or write your own numbers? (g/w): "); scanf(" %c", &answer); switch (answer) { case 'g': generateRandomNumbersInArray(array, sizeOfPart); break; case 'w': inputArray(array, sizeOfPart); break; default: printf("ERROR"); exit(1); } printf("Your array: "); outputArrray(array, sizeOfPart); n = searchLastNegativeInArray(array, sizeOfPart); if(n >= 0) { printf("The last negative number of array is %d. Its index is %d.\n", array[n], n); } else { printf("There's no negative numbers in your array.\n"); } n = searchFirstPositiveInArray(array, sizeOfPart); if(n >= 0) { printf("The first positive number of array is %d. Its index is %d.\n", array[n], n); } else { printf("There's no positive numbers in your array.\n"); } } else { printf("ERROR!"); exit(1); } return 0; }
int main() { int n; /*用于统计逆序对的个数,注意因为数组最大为100000,所以逆序对最多有(100000 * 100000)/2, 而这个数已经超出了int的表示范围,所以这里count要定义为long long类型*/ long long count; while(EOF != scanf("%d",&n)) { inputArray(n); count = countReversePair(n); printf("%lld\n",count); } return 0; }
int main() { int array[SIZE]; int number; printf("Fill the array with %d elements.\n", SIZE); inputArray(array, SIZE); universalClear(); printf("Your array: "); outputArrray(array, SIZE); printf("Enter the number: "); scanf("%d", &number); printf("%d", arraySearch(number, array, SIZE)); return 0; }