}
void concatenate(char string1[],char string2[],char string[]) {int i,j;
for (i=0;string1[i]!='\\0';i++) string[i]=string1[i];
for(j=0;string2[j]!='\\0';j++) string[i+j]=string2[j]; string[i+j]='\\0'; } 7-7
#include
{void cpy(char [],char []); char str[80],c[80]; printf(\ gets(str); cpy(str,c);
printf(\ return 0; }
void cpy(char s[],char c[]) { int i,j;
for (i=0,j=0;s[i]!='\\0';i++)
if (s[i]=='a'||s[i]=='A'||s[i]=='e'||s[i]=='E'||s[i]=='i'|| s[i]=='I'||s[i]=='o'||s[i]=='O'||s[i]=='u'||s[i]=='U') {c[j]=s[i]; j++; } c[j]='\\0'; } 7-8
#include
void insert(char []);
printf(\ scanf(\ insert(str); return 0;
}
void insert(char str[]) {int i;
for (i=strlen(str);i>0;i--) {str[2*i]=str[i]; str[2*i-1]=' '; }
printf(\} 7-9
#include
int letter,digit,space,others; int main()
{void count(char []); char text[80];
printf(\ gets(text);
printf(\ puts(text); letter=0; digit=0; space=0; others=0; count(text);
printf(\ return 0; }
void count(char str[]) {int i;
for (i=0;str[i]!='\\0';i++)
if ((str[i]>='a'&& str[i]<='z')||(str[i]>='A' && str[i]<='Z')) letter++;
else if (str[i]>='0' && str [i]<='9') digit++;
else if (str[i]==32) space++; else
others++; } 7-10
#include
#include
{int alphabetic(char); int longest(char []); int i;
char line[100];
printf(\ gets(line);
printf(\
for (i=longest(line);alphabetic(line[i]);i++) printf(\ printf(\ return 0; }
int alphabetic(char c)
{if ((c>='a' && c<='z')||(c>='A'&&c<='z')) return(1); else
return(0); }
int longest(char string[])
{int len=0,i,length=0,flag=1,place=0,point; for (i=0;i<=strlen(string);i++) if (alphabetic(string[i])) if (flag) {point=i; flag=0; } else
len++; else
{flag=1;
if (len>=length) {length=len; place=point; len=0; } }
return(place); }
7-11
#include
{void sort(char []); int i,flag;
for (flag=1;flag==1;)
{printf(\ scanf(\ if (strlen(str)>N)
printf(\ else
flag=0; }
sort(str);
printf(\ for (i=0;i void sort(char str[]) {int i,j; char t; for(j=1;j for (i=0;(i #include float score[N][M]; float a_stu[N],a_cour[M]; int r,c; int main() { int i,j; float h; float s_var(void); float highest(); void input_stu(void); void aver_stu(void); void aver_cour(void); input_stu(); aver_stu(); aver_cour(); printf(\ NO. cour1 cour2 cour3 cour4 cour5 for(i=0;i {printf(\ for(j=0;j printf(\ printf(\ } printf(\ for (j=0;j printf(\ printf(\ h=highest(); printf(\ NO. - course -\\n\ printf(\ return 0; } void input_stu(void) {int i,j; for (i=0;i {printf(\ for (j=0;j scanf(\ } } void aver_stu(void) {int i,j; float s; for (i=0;i {for (j=0,s=0;j aver\\n\