都用数组编写 2个简单的c程序

来源:百度知道 编辑:UC知道 时间:2024/05/17 04:52:09
1、已有一个已排好序的数组,今输入一个数,要求俺原来排序的规律将它插入数组中。
2、有一篇文章,共有13行文字,每行80个字符。要求分别统计出其中英文大写字母、小写字母、数字、空格以及其他字符的个数

谢谢了 尽快 帮mm问的。丢下太久了 都忘记了。。

贴出来后对齐和缩进格式变了,自己调整吧。
===================================================
1.第一个题目
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>

#define ARRAY_SIZE 50

int num_array[ARRAY_SIZE];

int init_array(int *num_array)
{
char num_buf[20]={0};
int ISNUM=1,i;
int elem;
int count=0,finished=0;
char exit='n',cache_char;
printf("Now you can initialize the number array.\n");
printf("Please input the number in a consistent order. Press any non digital charactor when finished.\n");
for (;finished==0&&count!=ARRAY_SIZE;) {
printf("%d ------:",count);
scanf("%s",&num_buf);
printf("\n");
i=0;

while( (num_buf[i]!='\0') && isdigit(num_buf[i]) ) i++;

if(i<strlen(num_buf))
ISNUM=0;
el