diff --git a/万维调考试题源码/4-1.c b/万维调考试题源码/4-1.c index 3e25162..b0a67c0 100644 --- a/万维调考试题源码/4-1.c +++ b/万维调考试题源码/4-1.c @@ -1,48 +1,28 @@ -/*----------------------------------------------------------------------- -ơ ------------------------------------------------------------------------ -дż֮ͣ -ʾ -100 222 656 899 65 -еż֮Ϊ978 -------------------------------------------------------------------------- -ע⣺Ķеݣ¶ -------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------- + +--------------------------------------------------------------------- +ʦͨרз׬ĵһ100 ˻ƣ +ÿ +4%棬ÿһ죬ȡ10 ѣʣµļơ +д +Ժ˻ϵǮᱻȡ(ʹdo....while) +--------------------------------------------------------------------- +ע⣺Դ¡Ķmain иݣ + +Program-End ֮䡣 +Ҫɾ־򲻵÷֡ +Ҫ޸ĻɾProgram-End ֮ݷ򲻵÷֡ +---------------------------------------------------------------------*/ #include -int sum_of_even(int arr[], int size); +#include int main() { - int numbers[5]; - int i; - int even_sum; - printf(""); - for (i = 0; i < 5; i++) - { - if (scanf("%d", &numbers[i]) != 1) - { - printf("ȷ\n"); - return 1; - } - if (numbers[i] <= 0) - { - printf("ȷ\n"); - return 1; - } - } - even_sum = sum_of_even(numbers, 5); - printf("еż֮Ϊ%d\n", even_sum); - return 0; -} -int sum_of_even(int arr[], int size) -{ - int sum = 0; - int i; + int money = 100; + int year = 1; /**********Program**********/ - for(i=0;i -void fun(char *a) +void sort(int *, int); +void main() { + int a[5], i; + for (i = 0; i < 5; i++) + { + scanf("%d,", &a[i]); + } + sort(a, 5); + for (i = 0; i < 5; i++) + { + printf("%d ", a[i]); + } + printf("\n"); +} +void sort(int *p, int n) +{ + int i, j, temp; /**********Program**********/ - char *p,*q; - p=a; - while(*p == '*'){ - p++; - } - for(q=p;q > a;q--){ - p=q; - while(*p != '\0'){ - *(p-1) = *p; - p++; - } - *(p-1) = '\0'; - } + /********** End **********/ -} -main() -{ - char s[81]; - printf("Enter a string:\n"); - gets(s); - fun(s); - printf("The string after deleted:\n"); - puts(s); -} +} \ No newline at end of file