原来是南开100题啊- -谢谢yql...我都不知道
第一个是
#include
#include
#include
void fun(int a, int b, long *c)
{
int a1, a2, b1, b2; /*分别存放a十位,a个位,b十位,b个位的数字*/
a1 = a/10;
a2 = a%10;
b1 = b/10;
b2 = b%10;
*c = a1 * 1000 + b2 * 100 + a2 * 10 + b1; /*数字按要求组合,存入c*/
}
main()
{
int a, b;
long c=0;
system("cls");
printf("Input a,b:");
scanf("%d%d",&a,&b);
fun(a,b,&c);
printf("The result is: %ld\n",c);
return 0;
}
第二个是 你自己编主函数吧
void fun(char *a,char *p)
{
char *i,*j;
i = j =a;
while(j != p){
if(*j!='*'){
*i = *j;
i++;
}
j++;
}
while(*j){
*i++ = *j++;
}
*i = '\0';
}
第三个是
void fun(char *tt, int pp[])
{
int i;
for (i=0;i<26;i++)
pp[i]=0;
while (*tt)
{
switch (*tt)
{
case ‘a’: pp[0]++;break;
case ‘b’: pp[1]++;break;
case ‘c’: pp[2]++;break;
case ‘d’: pp[3]++;break;
case ‘e’: pp[4]++;break;
case ‘f’: pp[5]++;break;
case ‘g’: pp[6]++;break;
case ‘h’: pp[7]++;break;
case ‘i’: pp[8]++;break;
case ‘j’: pp[9]++;break;
case ‘k’: pp[10]++;break;
case ‘l’: pp[11]++;break;
case ‘m’: pp[12]++;break;
case ‘n’: pp[12]++;break;
case ‘o’: pp[14]++;break;
case ‘p’: pp[15]++;break;
case ‘q’: pp[16]++;break;
case ‘r’: pp[17]++;break;
case ‘s’: pp[18]++;break;
case ‘t’: pp[19]++;break;
case ‘u’: pp[20]++;break;
case ‘v’: pp[21]++;break;
case ‘w’: pp[22]++;break;
case ‘x’: pp[23]++;break;
case ‘y’: pp[24]++;break;
case ‘z’: pp[25]++;break;
}
tt++;
}
}
没学过还做这种题,不是为难自己吗?一楼的回答的挺好的。顶他
建议你找下南开100题都有·······