急~期末c语言上机考试题

c\u8bed\u8a00\u671f\u672b\u4e0a\u673a\u8003\u8bd5\u9898\u7b54\u6848\u5f81\u96c6\uff1f

//\u5f00\u53d1\u73af\u5883\uff1aBC++31

//\u7b2c\u4e00\u9898
#include
#include

void main(void)
{
int i,j;

clrscr();
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
{
if(j==1)
{
printf("%2d ",i);
}
else
{
printf("%2d ",i*j);
}
}
printf("\n");
}
}

//\u7b2c\u4e8c\u9898
#include
#include

void main(void)
{
char str[6]={'A','B','C','D','E','Z'};
int i,j;

clrscr();
for(i=6;i>=1;i--)
{
for(j=i%6;j<=i%6+5;j++)
{
printf("%2c",str[j%6]);
}
printf("\n");
}
}

//\u7b2c\u4e09\u9898
#include
#include
#include

void circlewordif(char *p)
{
int l,i;

l=strlen(p);
for(i=0;i<=i/2;i++)
{
if(*p!=*(p+l-i-1))
{
break;
}
}
if(i<=i/2)
{
printf("NO!");
}
else
{
printf("YES!");
}
}

void main(void)
{
char str[100];

clrscr();
printf("Please input the string:");
gets(str);
circlewordif(str);
}

//\u7b2c\u516b\u9898
#include
#include
#include

void main(void)
{
int num=0;

clrscr();
while((int)(sqrt(num+100))*(int)(sqrt(num+100))!=num+100||(int)(sqrt(num+168))*(int)(sqrt(num+168))!=num+168)
{
num++;
}
printf("The Answer is:%d\n",num);
printf("Please input the day:(1~31)");
scanf("%d",&num);
printf("The Answer is:%d\n",(num+4)%7);
}

//\u7b2c\u4e5d\u9898
#include
#include

void main(void)
{
int num[3][3];
int i,j,k;

clrscr();
for(i=0;i<3;i++)
{
printf("Please input line %d:",i);
scanf("%d,%d,%d",&num[i][0],&num[i][1],&num[i][2]);
}
printf("Before Change...\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%2d ",num[i][j]);
}
printf("\n");
}
for(i=0;i<3;i++)
{
for(j=i+1;j<3;j++)
{
k=num[i][j];
num[i][j]=num[j][i];
num[j][i]=k;
}
}
printf("After Change...\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%2d ",num[i][j]);
}
printf("\n");
}
}

//\u7b2c\u5341\u9898
#include
#include

void main(void)
{
int num[8];
int *max,*min;
int i,j;

clrscr();
printf("Please input 8 numbers:\n");
for(i=0;i<8;i++)
{
scanf("%d",&num[i]);
}
printf("Your numbers are...\n");
for(i=0;i<8;i++)
{
printf("%2d",num[i]);
}
max=num;min=num;
for(i=0;i<8;i++)
{
if(num[i]>*max)
{
max=&num[i];
}
if(num[i]<*min)
{
min=&num[i];
}
}
j=*min;*min=*max;*max=j;
printf("\nAfter Change...\n");
for(i=0;i<8;i++)
{
printf("%2d",num[i]);
}
}

//\u7b2c\u5341\u4e00\u9898
#include
#include
#include
#include

void main(void)
{
int n,i,j,t,*max,num;
int count[4]={0};

clrscr();
randomize();
printf("Please input the people's number:\nn=");
scanf("%d",&n);
printf("Vote Start...\n");
for(i=0;i<n;i++)
{
t=random(4);
if(t3)
{
i--;
continue;
}
count[t]++;
printf("%-2c",t+65);
}
printf("\nVote Complete...\n");
for(i=0;i<4;i++)
{
max=count;num=0;
for(j=1;j<4;j++)
{
if(count[j]>*max)
{
max=&count[j];
num=j;
}
}
printf("%d.%c---->%d\n",i+1,num+65,*max);
*max=0;
}
}

\u7ebf\u6027\u8868
1\u3001\u67d0\u8f6f\u4ef6\u516c\u53f8\u5927\u7ea6\u670930\u540d\u5458\u5de5\uff0c\u6bcf\u540d\u5458\u5de5\u6709\u59d3\u540d\u3001\u5de5\u53f7\u3001\u804c\u52a1\u7b49\u5c5e\u6027\uff0c\u6bcf\u5e74\u90fd\u6709\u5458\u5de5\u79bb\u804c\u548c\u5165\u804c\u3002
\u628a\u6240\u6709\u5458\u5de5\u6309\u7167\u987a\u5e8f\u5b58\u50a8\u7ed3\u6784\u5efa\u7acb\u4e00\u4e2a\u7ebf\u6027\u8868\uff0c\u5efa\u7acb\u79bb\u804c\u548c\u5165\u804c\u51fd\u6570\uff0c\u5f53\u6709\u5458\u5de5\u79bb\u804c\u6216\u5165\u804c\u65f6\uff0c\u4fee\u6539\u7ebf\u6027\u8868\uff0c\u5e76\u4e14\u6253\u5370\u6700\u65b0\u7684\u5458\u5de5\u540d\u5355\u3002
2\u3001\u7ea6\u745f\u592b\uff08Josephus\uff09\u73af\u95ee\u9898\uff1a\u7f16\u53f7\u4e3a1,2,3,\u2026,n\u7684n\u4e2a\u4eba\u6309\u987a\u65f6\u9488\u65b9\u5411\u56f4\u5750\u4e00\u5708\uff0c\u6bcf\u4eba\u6301\u6709\u4e00\u4e2a\u5bc6\u7801\uff08\u6b63\u6574\u6570\uff09\u3002\u4e00\u5f00\u59cb\u4efb\u9009\u4e00\u4e2a\u6b63\u6574\u6570\u4f5c\u4e3a\u62a5\u6570\u7684\u4e0a\u9650\u503cm\uff0c\u4ece\u7b2c\u4e00\u4e2a\u4eba\u5f00\u59cb\u6309\u987a\u65f6\u9488\u65b9\u5411\u81ea1\u5f00\u59cb\u987a\u5e8f\u62a5\u6570,\u62a5\u5230m\u65f6\u505c\u6b62\u3002\u62a5m\u7684\u4eba\u51fa\u5217\uff0c\u5c06\u4ed6\u7684\u5bc6\u7801\u4f5c\u4e3a\u65b0\u7684m\u503c\uff0c\u4ece\u4ed6\u5728\u987a\u65f6\u9488\u65b9\u5411\u4e0a\u7684\u4e0b\u4e00\u4eba\u5f00\u59cb\u91cd\u65b0\u4ece1\u62a5\u6570\uff0c\u5982\u6b64\u4e0b\u53bb\uff0c\u76f4\u5230\u6240\u6709\u4eba\u5168\u90e8\u51fa\u5217\u4e3a\u6b62\u3002
\u5efa\u7acbn\u4e2a\u4eba\u7684\u5355\u5faa\u73af\u94fe\u8868\u5b58\u50a8\u7ed3\u6784\uff0c\u8fd0\u884c\u7ed3\u675f\u540e\uff0c\u8f93\u51fa\u4f9d\u6b21\u51fa\u961f\u7684\u4eba\u7684\u5e8f\u53f7\u3002
\u6808\u548c\u961f\u5217
3\u3001\u67d0\u5546\u573a\u6709\u4e00\u4e2a100\u4e2a\u8f66\u4f4d\u7684\u505c\u8f66\u573a\uff0c\u5f53\u8f66\u4f4d\u672a\u6ee1\u65f6\uff0c\u7b49\u5f85\u7684\u8f66\u8f86\u53ef\u4ee5\u8fdb\u5165\u5e76\u8ba1\u65f6\uff1b\u5f53\u8f66\u4f4d\u5df2\u6ee1\u65f6\uff0c\u5fc5\u987b\u6709\u8f66\u8f86\u79bb\u5f00\uff0c\u7b49\u5f85\u7684\u8f66\u8f86\u624d\u80fd\u8fdb\u5165\uff1b\u5f53\u8f66\u8f86\u79bb\u5f00\u65f6\u8ba1\u7b97\u505c\u7559\u7684\u7684\u65f6\u95f4\uff0c\u5e76\u4e14\u6309\u7167\u6bcf\u5c0f\u65f61\u5143\u6536\u8d39\u3002
\u6c7d\u8f66\u7684\u8f93\u5165\u4fe1\u606f\u683c\u5f0f\u53ef\u4ee5\u662f\uff08\u8fdb\u5165/\u79bb\u5f00\uff0c\u8f66\u724c\u53f7\uff0c\u8fdb\u5165/\u79bb\u5f00\u65f6\u95f4\uff09\uff0c\u8981\u6c42\u53ef\u4ee5\u968f\u65f6\u663e\u793a\u505c\u8f66\u573a\u5185\u7684\u8f66\u8f86\u4fe1\u606f\u4ee5\u53ca\u6536\u8d39\u5386\u53f2\u8bb0\u5f55\u3002
4\u3001\u67d0\u94f6\u884c\u8425\u4e1a\u5385\u5171\u67096\u4e2a\u8425\u4e1a\u7a97\u53e3\uff0c\u8bbe\u6709\u6392\u961f\u7cfb\u7edf\u5e7f\u64ad\u53eb\u53f7\uff0c\u8be5\u94f6\u884c\u7684\u4e1a\u52a1\u5206\u4e3a\u516c\u79ef\u91d1\u3001\u94f6\u884c\u5361\u3001\u7406\u8d22\u5361\u7b49\u4e09\u79cd\u3002\u516c\u79ef\u91d1\u4e1a\u52a1\u6307\u5b9a1\u53f7\u7a97\u53e3\uff0c\u94f6\u884c\u5361\u4e1a\u52a1\u6307\u5b9a2\u30013\u30014\u53f7\u7a97\u53e3\uff0c\u7406\u8d22\u5361\u4e1a\u52a1\u6307\u5b9a5\u30016\u53f7\u7a97\u53e3\u3002\u4f46\u5982\u679c5\u30016\u53f7\u7a97\u53e3\u5168\u5fd9\uff0c\u800c2\u30013\u30014\u53f7\u7a97\u53e3\u6709\u7a7a\u95f2\u65f6\uff0c\u7406\u8d22\u5361\u4e1a\u52a1\u4e5f\u53ef\u4ee5\u5728\u7a7a\u95f2\u76842\u30013\u30014\u53f7\u7a97\u53e3\u4e4b\u4e00\u529e\u7406\u3002
\u5ba2\u6237\u9886\u53f7\u3001\u4e1a\u52a1\u5b8c\u6210\u53ef\u4ee5\u4f5c\u4e3a\u8f93\u5165\u4fe1\u606f\uff0c\u8981\u6c42\u53ef\u4ee5\u968f\u65f6\u663e\u793a6\u4e2a\u8425\u4e1a\u7a97\u53e3\u7684\u72b6\u6001\u3002
5\u30014\u9636\u6590\u6ce2\u90a3\u5951\u5e8f\u5217\u5982\u4e0b\uff1af0=f1=f2=0, f3=1,\u2026,fi=fi-1+fi-2+fi-3+fi-4\uff0c
\u5229\u7528\u5bb9\u91cf\u4e3ak=4\u7684\u5faa\u73af\u961f\u5217\uff0c\u6784\u9020\u5e8f\u5217\u7684\u524dn+1\u9879\uff08f0, f1 , f2 ,\u2026 fn \uff09\uff0c\u8981\u6c42\u6ee1\u8db3fn \u2264200\u800cfn+1 >200\u3002
6\u3001\u516b\u7687\u540e\u95ee\u9898\uff1a\u8bbe8\u7687\u540e\u95ee\u9898\u7684\u89e3\u4e3a (x1, x2, x3, \u2026,x8), \u7ea6\u675f\u6761\u4ef6\u4e3a\uff1a\u57288x8\u7684\u68cb\u76d8\u4e0a\uff0c\u5176\u4e2d\u4efb\u610f\u4e24\u4e2axi \u548cxj\u4e0d\u80fd\u4f4d\u4e8e\u68cb\u76d8\u7684\u540c\u884c\u3001\u540c\u5217\u53ca\u540c\u5bf9\u89d2\u7ebf\u3002\u8981\u6c42\u7528\u4e00\u4f4d\u6570\u7ec4\u8fdb\u884c\u5b58\u50a8\uff0c\u8f93\u51fa\u6240\u6709\u53ef\u80fd\u7684\u6392\u5217\u3002
7\u3001\u8ff7\u5bab\u6c42\u89e3\uff1a\u7528\u4e8c\u7ef4\u77e9\u9635\u8868\u793a\u8ff7\u5bab\uff0c\u81ea\u52a8\u751f\u6210\u6216\u8005\u76f4\u63a5\u8f93\u5165\u8ff7\u5bab\u7684\u683c\u5c40\uff0c\u786e\u5b9a\u8ff7\u5bab\u662f\u5426\u80fd\u8d70\u901a\uff0c\u5982\u679c\u80fd\u8d70\u901a\uff0c\u8f93\u51fa\u884c\u8d70\u8def\u7ebf\u3002
8\u3001\u82f1\u56fd\u4eba\u683c\u601d\u91cc\u4e8e1852\u5e74\u63d0\u51fa\u56db\u8272\u95ee\u9898(four colour problem\uff0c\u4ea6\u79f0\u56db\u8272\u731c\u60f3\uff09\uff0c\u5373\u5728\u4e3a\u4e00\u5e73\u9762\u6216\u4e00\u7403\u9762\u7684\u5730\u56fe\u7740\u8272\u65f6\uff0c\u5047\u5b9a\u6bcf\u4e00\u4e2a\u56fd\u5bb6\u5728\u5730\u56fe\u4e0a\u662f\u4e00\u4e2a\u8fde\u901a\u57df\uff0c\u5e76\u4e14\u6709\u76f8\u90bb\u8fb9\u754c\u7ebf\u7684\u4e24\u4e2a\u56fd\u5bb6\u5fc5\u987b\u7528\u4e0d\u540c\u7684\u989c\u8272\uff0c\u95ee\u662f\u5426\u53ea\u8981\u56db\u79cd\u989c\u8272\u5c31\u53ef\u5b8c\u6210\u7740\u8272\u3002\u73b0\u5728\u7ed9\u5b9a\u4e00\u5f20\u5730\u56fe\uff0c\u8981\u6c42\u5bf9\u8fd9\u5f20\u5730\u56fe\u4e0a\u7684\u56fd\u5bb6\u7528\u4e0d\u8d85\u8fc7\u56db\u79cd\u7684\u989c\u8272\u8fdb\u884c\u67d3\u8272\u3002
\u8981\u6c42\u5efa\u7acb\u5730\u56fe\u7684\u90bb\u63a5\u77e9\u9635\u5b58\u50a8\u7ed3\u6784\uff0c\u8f93\u5165\u56fd\u5bb6\u7684\u4e2a\u6570\u548c\u76f8\u90bb\u60c5\u51b5\uff0c\u8f93\u51fa\u6bcf\u4e2a\u56fd\u5bb6\u7684\u989c\u8272\u4ee3\u7801\u3002
9\u3001\u4ee5\u4e0b\u95ee\u9898\u8981\u6c42\u7edf\u4e00\u5728\u4e00\u4e2a\u5927\u7a0b\u5e8f\u91cc\u89e3\u51b3\u3002
\u4ece\u539f\u56db\u5219\u8868\u8fbe\u5f0f\u6c42\u5f97\u540e\u7f00\u5f0f\uff0c\u540e\u7f00\u8868\u8fbe\u5f0f\u6c42\u503c\uff0c\u4ece\u539f\u56db\u5219\u8868\u8fbe\u5f0f\u6c42\u5f97\u4e2d\u7f00\u8868\u8fbe\u5f0f\uff0c\u4ece\u539f\u56db\u5219\u8868\u8fbe\u5f0f\u6c42\u5f97\u524d\u7f00\u8868\u8fbe\u5f0f\uff0c\u524d\u7f00\u8868\u8fbe\u5f0f\u6c42\u503c\u3002
\u6570\u7ec4\u4e0e\u5e7f\u4e49\u8868
10\u3001\u978d\u70b9\u95ee\u9898\uff1a \u82e5\u77e9\u9635A\u4e2d\u7684\u67d0\u4e00\u5143\u7d20A[i,j]\u662f\u7b2ci\u884c\u4e2d\u7684\u6700\u5c0f\u503c\uff0c\u800c\u53c8\u662f\u7b2cj\u5217\u4e2d\u7684\u6700\u5927\u503c\uff0c\u5219\u79f0A[i,j]\u662f\u77e9\u9635A\u4e2d\u7684\u4e00\u4e2a\u978d\u70b9\u3002\u5199\u51fa\u4e00\u4e2a\u53ef\u4ee5\u786e\u5b9a\u978d\u70b9\u4f4d\u7f6e\u7684\u7a0b\u5e8f\u3002
11\u3001\u7a00\u758f\u77e9\u9635\u8f6c\u7f6e\uff1a \u8f93\u5165\u7a00\u758f\u77e9\u9635\u4e2d\u6bcf\u4e2a\u5143\u7d20\u7684\u884c\u53f7\u3001\u5217\u53f7\u3001\u503c\uff0c\u5efa\u7acb\u7a00\u758f\u77e9\u9635\u7684\u4e09\u5143\u7ec4\u5b58\u50a8\u7ed3\u6784\uff0c\u5e76\u5c06\u6b64\u77e9\u9635\u8f6c\u7f6e\uff0c\u663e\u793a\u8f6c\u7f6e\u524d\u540e\u7684\u4e09\u5143\u7ec4\u7ed3\u6784\u3002
12\u3001\u7528\u5934\u5c3e\u94fe\u8868\u5b58\u50a8\u8868\u793a\u6cd5\u5efa\u7acb\u5e7f\u4e49\u8868\uff0c\u8f93\u51fa\u5e7f\u4e49\u8868\uff0c\u6c42\u5e7f\u4e49\u8868\u7684\u8868\u5934\u3001\u5e7f\u4e49\u8868\u7684\u8868\u5c3e\u548c\u5e7f\u4e49\u8868\u7684\u6df1\u5ea6\u3002
\u6811\u548c\u4e8c\u53c9\u6811
\u4ee5\u4e0b\u95ee\u9898\u8981\u6c42\u7edf\u4e00\u5728\u4e00\u4e2a\u5927\u7a0b\u5e8f\u91cc\u89e3\u51b3\u3002
13\u3001\u6309\u5148\u5e8f\u904d\u5386\u7684\u6269\u5c55\u5e8f\u5217\u5efa\u7acb\u4e8c\u53c9\u6811\u7684\u5b58\u50a8\u7ed3\u6784
14\u3001\u4e8c\u53c9\u6811\u5148\u5e8f\u3001\u4e2d\u5e8f\u3001\u540e\u5e8f\u904d\u5386\u7684\u9012\u5f52\u7b97\u6cd5
15\u3001\u4e8c\u53c9\u6811\u4e2d\u5e8f\u904d\u5386\u7684\u975e\u9012\u5f52\u7b97\u6cd5
16\u3001\u4e8c\u53c9\u6811\u5c42\u6b21\u904d\u5386\u7684\u975e\u9012\u5f52\u7b97\u6cd5
17\u3001\u6c42\u4e8c\u53c9\u6811\u7684\u6df1\u5ea6(\u540e\u5e8f\u904d\u5386)
18\u3001\u5efa\u7acb\u6811\u7684\u5b58\u50a8\u7ed3\u6784
19\u3001\u6c42\u6811\u7684\u6df1\u5ea6
\u56fe
20\u3001\u8f93\u5165\u4efb\u610f\u7684\u4e00\u4e2a\u7f51\uff0c\u7528\u666e\u91cc\u59c6(Prim)\u7b97\u6cd5\u6784\u9020\u6700\u5c0f\u751f\u6210\u6811\u3002
21\u3001\u8981\u6c42\u5efa\u7acb\u56fe\u7684\u5b58\u50a8\u7ed3\u6784\uff08\u90bb\u63a5\u8868\u6216\u90bb\u63a5\u77e9\u9635\uff09\uff0c\u8f93\u5165\u4efb\u610f\u7684\u4e00\u4e2a\u56fe\uff0c\u663e\u793a\u56fe\u7684\u6df1\u5ea6\u4f18\u5148\u641c\u7d22\u904d\u5386\u8def\u5f84\u3002
22\u3001\u8981\u6c42\u5efa\u7acb\u56fe\u7684\u5b58\u50a8\u7ed3\u6784\uff08\u90bb\u63a5\u8868\u6216\u90bb\u63a5\u77e9\u9635\uff09\uff0c\u8f93\u5165\u4efb\u610f\u7684\u4e00\u4e2a\u56fe\uff0c\u663e\u793a\u56fe\u7684\u5e7f\u5ea6\u4f18\u5148\u641c\u7d22\u904d\u5386\u8def\u5f84\u3002
\u67e5\u627e
23\u3001\u8bbe\u8ba1\u4e00\u4e2a\u8bfb\u5165\u4e00\u4e32\u6574\u6570\u6784\u6210\u4e00\u9897\u4e8c\u53c9\u6392\u5e8f\u6811\u7684\u7a0b\u5e8f\uff0c\u4ece\u4e8c\u53c9\u6392\u5e8f\u6811\u4e2d\u5220\u9664\u4e00\u4e2a\u7ed3\u70b9\uff0c\u4f7f\u8be5\u4e8c\u53c9\u6811\u4ecd\u4fdd\u6301\u4e8c\u53c9\u6392\u5e8f\u6811\u7684\u7279\u6027\u3002
24\u3001\u8bbe\u5b9a\u54c8\u5e0c\u51fd\u6570 H(key) = key MOD 11 ( \u8868\u957f=11 )\uff0c\u8f93\u5165\u4e00\u7ec4\u5173\u952e\u5b57\u5e8f\u5217\uff0c\u6839\u636e\u7ebf\u6027\u63a2\u6d4b\u518d\u6563\u5217\u89e3\u51b3\u51b2\u7a81\u7684\u65b9\u6cd5\u5efa\u7acb\u54c8\u5e0c\u8868\u7684\u5b58\u50a8\u7ed3\u6784\uff0c\u663e\u793a\u54c8\u5e0c\u8868\uff0c\u4efb\u610f\u8f93\u5165\u5173\u952e\u5b57\uff0c\u5224\u65ad\u662f\u5426\u5728\u54c8\u5e0c\u8868\u4e2d\u3002
\u6392\u5e8f
\u4ee5\u4e0b\u95ee\u9898\u8981\u6c42\u7edf\u4e00\u5728\u4e00\u4e2a\u5927\u7a0b\u5e8f\u91cc\u89e3\u51b3\u3002
25\u3001\u6298\u534a\u63d2\u5165\u6392\u5e8f
26\u3001\u5192\u6ce1\u6392\u5e8f
27\u3001\u5feb\u901f\u6392\u5e8f
28\u3001\u7b80\u5355\u9009\u62e9\u6392\u5e8f
29\u3001\u5f52\u5e76\u6392\u5e8f
30\u3001\u5806\u6392\u5e8f

\u8fd9\u4e9b\u662f\u6211\u4eec\u7684\u4e0a\u673a\u9898\u76ee \u8bf7\u53c2\u8003

1:
#include <stdio.h>
main()
{
float p=100,h=p/2;
int i;
for(i=2;i<=10;i++)
{
p=p+2*h;
h=h/2;
}
printf("%6.3f%6.3f\n",p,h);
return 0;
}

2:

#include <stdio.h>
main()
{
int a[3][3],i,j,sum=0;
for(j=0;j<3;j++)
for(i=0;i<3;i++)
scanf("%d",&a[j][i]);
for(i=0;i<3;i++)
sum=sum+a[i][i];
printf("%d\n",sum);
}

3:

#include <stdio.h>
main()
{
void cpy();
char a[100],b[100];
printf("请输入字符:");
gets(a);
cpy(a,b);
printf("%s",b);
}
void cpy(t,str)
char t[],str[];
{

int i,j=0;
for(i=0;t[i]!='\0';i++)
if(t[i]=='a'||t[i]=='e'||t[i]=='i'||t[i]=='o'||t[i]=='u'||t[i]=='A'||t[i]=='E'||t[i]=='I'||t[i]=='O'||t[i]=='U')
{
str[j]=t[i];
j++;
}
str[j]='\0';
}

分给我吧
这些我都写过
马上给你写ok?
第3题:
#include <stdio.h>
void copyvowel(char stra[],char strb[]);
main()
{
char stra[20],strb[20];
printf("input a string:");
scanf("%s",stra);
copyvowel(stra,strb);
printf("%s\n",strb);
}
void copyvowel(char stra[],char strb[])
{
char vowel[]="aeiou";
int i=0,j,k=0;
while(stra[i++]!='\0')
{
j=0;
while(vowel[j]!='\0')
{
if(stra[i]==vowel[j++])
{
strb[k++]=stra[i];
break;
}
}
}
strb[k]='\0';
}
第2题:
#include <stdio.h>
main()
{
int i,j, a[3][3]={{3,5,7},{4,6,1},{9,8,0}};
printf("the array is:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d ",a[i][j]);
}
printf("\n");
}
int sum=0;
for(i=0,j=2;i<3;i++,j--)
{
if(i!=j)
sum+=a[i][i]+a[i][j];
else
{sum+=a[i][i];}
}
printf("sum is %d\n",sum);
}
第1题:
#include <stdio.h>
main()
{
float height,sum;
int i;
for(i=1,height=100;i<=10;i++)
{
sum+=height;
height/=2;
}
printf("共经过%f米,第10次反弹%f米.\n",sum,height);
}
分给我吧!

/*3.写1个函数,将一个字符串中的元音字母复制到另一字符串,然后输出。*/
#include"stdio.h"
main()
{
char c[100],ch,a[5]="aeiuo",t[100];
int i=0,n,j,k=0;
printf("input chuan :\n");
ch=getchar(); /*从键盘输入字符*/
while(ch!='\n')
{
c[i++]=ch;/*把从键盘输入字符赋值给c数组*/
ch=getchar();
}
n=i;
for(i=0;i<n;i++)
for(j=0;j<5;j++) /*比较元音字符*/
{
if(c[i]==a[j])
t[k++]=c[i];/*将元音字符放到另一个数组*/
}
t[k]='\0';
printf("%s\n",t); /*输出元音字符数组*/

}

/*一个球从100m高度自由下落,每次落地后反跳回原高度的一半,再下落,
再反弹。求它在第10次落地时,共经过了多少米?第10次反弹多高*/
#include"stdio.h"
main()
{
float sn=100.0,hn=sn/2;
int n;
for(n=2;n<=10;n++)
{
sn=sn+2*hn;
hn=hn/2;
printf("the height:%f\n",hn); /*输出每次高度*/
}
printf("the total of road is %f\n",sn);/*共经过的路程*/
printf("the tenth is %f meter\n",hn);/*第十次的高度*/

}

/*求1个3x3的整型二维数组对角线元素之和*/
#include"stdio.h"
main()
{
float a[3][3],sum=0;
int i,j;
printf("please input rectangle element:\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%f",&a[j]); /*从键盘输入矩阵元素*/
for(i=0;i<3;i++)
sum=sum+a[i][j]; /*对角线元素求和*/
printf("duijiaoxian he is %6.2f",sum);
}

  • C璇█鑰冭瘯棰 鎬ユ鎬!!!
    绛旓細C璇█鑰冭瘯棰 鎬ユ鎬!!!10 涓銆侀夋嫨棰 鑻=3,鍒欐墽琛岃鍙: a=b++鍚,鍙橀噺b鐨勫兼槸( )銆 A)3 B)4 C)5 D)涓嶅畾 璁炬湁濡備笅瀹氫箟: int a=4,b=3,c=2,d=1,x=0,y=0; 鍒欐墽琛岃〃杈惧紡:(x=a>b)||(y=c>d)鍚,n鐨勫间负( )銆 A) 1 B)2 C)3 ......
  • c璇█鑰冭瘯,姹傜瓟妗,鎬!!鎬!!
    绛旓細c璇█鑰冭瘯,姹傜瓟妗,鎬!!鎬!! }浜斻佺▼搴忚璁¢(鏈ぇ棰樺叡2灏忛,姣忓皬棰12鍒,鍏24鍒)36.璁炬湁-11,-9,0,3,5,6,8,12,15,21鍗佷釜鏁,璇风紪绋嬩粠閿洏涓婅緭鍏ヨ繖鍗佷釜鏁,骞惰绠楄兘澶熻3鏁撮櫎鐨勬暟鐨勫钩鍧囧笺37.缂栦竴涓眰绱犳暟鐨勫嚱... }浜斻佺▼搴忚璁¢(鏈ぇ棰樺叡2灏忛,姣忓皬棰12鍒,鍏24鍒)36.璁炬湁-11,-9,...
  • C璇█鑰冭瘯 鎬~~ 棰樼洰:浜х敓骞惰緭鍑烘潹杈変笁瑙掔殑鍓嶄竷琛屻 1 1 1 1 2 1...
    绛旓細浠ヤ笅涓烘纭瓟妗堬紝绋嬪簭涓婃満杩愯閫氳繃銆傛偍鐨勬簮绋嬪簭涓湁涓涓皬灏忕殑閿欒锛屽皯浜嗕竴瀵箋}銆俰nclude <stdio.h> int main( ){ int a[7][7],i,j;for (i=0;i<7;i++){ a[i][0]=1;/***SPACE***/ a[i][i]=1;} for (i=2;i<7;i++)for (j=1;j<i;j++)/***SPACE***/ a[i]...
  • 绱фユ眰鏁:鑰冭瘯瑕佺敤鍒扮殑鍏亾c璇█鐨勭紪绋嬮 璇烽珮鎵嬪府蹇欑粰鍑虹瓟妗,鏈濂芥槸...
    绛旓細//1 缂栫▼璁$畻1锝100涔嬮棿鐨勬墍鏈夌礌鏁颁箣鍜屻俰nclude <stdio.h> include <math.h> int search(int i);main(){ int i,num;num=0;for(i=2;i<101;i++){ if(search(i)){ num+=i;printf("%d ",i);} } } int search(int i){ int k,j;for(k=i/2;k>1;k--){ j=i;j=j/...
  • c璇█鍗曠墖鏈鑰冭瘯棰樼洰鎬鐢
    绛旓細1銆乽char state1;//涓诲嚱鏁颁腑 鏈 state1 鍙橀噺锛屾暣涓▼搴忓嵈娌℃湁鏀瑰彉閲忓畾涔夛紝鍙煡锛岀1绌哄嵆鏄鍙橀噺鐨勫畾涔夈2銆乻tate1=0xfe; 鎴栬 state1=~1;//鍥句腑 LED涓 浣庣數骞抽┍鍔紝D1涓 P10锛屽惊鐜腑鐩存帴灏唖tate1鐨勫艰祴鍊肩粰 P1锛屾墍浠ワ紝瑕佹兂D1浜紝state1 鐨勫煎氨 蹇呴』=0xfe 3銆乼emp=4;//棰樼洰瑕佹眰 ...
  • c璇█棰樼洰銆鑰冭瘯鐢ㄧ殑鈥︹︽モ︹︽モ︹︽モ︹
    绛旓細int i,a,b,c;for(i=100;i<=999;i++){ a=i/100%10;b=i/10%10;c=i%10;if(i==pow(a,3)+pow(b,3)+pow(c,3))printf("\t%d",i);} } 5銆 杈撳叆涓変釜瀹炴暟鍙橀噺锛屾寜浠庡ぇ鍒板皬鐨勯『搴忔墦鍗板嚭鏁版嵁銆傦紙鐢ㄦ寚閽堟潵瀹炵幇锛塱nclude<stdio.h> main(){ int *a,*b,*c,temp;int d,e,f...
  • c璇█鑰冭瘯 鎬ユ眰 鍦ㄧ嚎绛
    绛旓細绗洓棰 include<stdio.h> double multiplication(double x,double y){ double s;s=x*y;return(s);} main(){ printf("璇疯緭鍏ヤ笁涓疄鏁帮細");double a,b,c,d;scanf("%f%f%f",&a,&b,&c);d=multiplication(a,b);d=multiplication(d,c);printf("杩欎笁涓暟鐨勭Н涓%f\n",d);} 绗簲...
  • 杩欐槸鎴戜滑鏈熸湯C璇█鑰冭瘯棰樼洰,杩樻湁鎴戝仛鐨,姹傚ぇ绁炲府甯繖,鎴戠殑瀵瑰悧?閿欏湪...
    绛旓細include <stdio.h>int main(){ float income; float a; float tax; printf("杈撳叆涓汉鏀跺叆(>0): "); scanf("%f",&income); if(income < 0) { printf("杈撳叆閿欒!\n"); return -1; } if(income > 0 && income <= 2000) { printf("鏀跺叆鏈...
  • 姹c璇█璇曢鍙婄瓟妗!鎬ュ晩!
    绛旓細姹c璇█璇曢鍙婄瓟妗!鎬ュ晩!鎴戜滑鏄庡ぉ鏃╀笂鑰冭瘯,绗旇瘯!鎬!!璋㈣阿鍟!... 姹俢璇█璇曢鍙婄瓟妗!鎬ュ晩!鎴戜滑鏄庡ぉ鏃╀笂鑰冭瘯,绗旇瘯!鎬!!璋㈣阿鍟! 灞曞紑  鎴戞潵绛 2涓洖绛 #鐑# 鐢熸椿涓湁鍝簺鎴愮樉椋熺墿?鍖垮悕鐢ㄦ埛 2013-07-26 灞曞紑鍏ㄩ儴 c璇█鑰冭瘯棰(涓) 涓銆 鍗曢」閫夋嫨棰(姣忛2鍒,鍏20鍒)1銆佷互涓嬮夐」涓睘浜C璇█鐨...
  • C璇█鑰冭瘯鎬ョ潃鐢ㄥぇ瀹跺府甯繖
    绛旓細绗竴棰橈紝缃戜笂鎵句簡涓涓紝浣犺嚜宸辫皟璇曚竴涓嬪惂锛屽ソ鍍忔病闂锛岃繖浜涚▼搴忕綉涓婃湁寰堝锛屼綘鑷繁鍙互鏌ョ殑銆俰nt panduan(int a,int b,int c){ int m;m=b*b-4*a*c;return(m);} void main(){ int a,b,c,flag;int x1,x2,ture,virture;printf("璇蜂緷娆¤緭鍏ヤ簩娆℃柟绋嬬殑绯绘暟锛歕n");scanf("%d",&a...
  • 扩展阅读:试题扫一扫出答案 ... 2024年期末考试答案 ... 免费答题扫一扫 ... 科目一全部试题及答案 ... 2023一2024期末测试卷 ... 扫一扫搜答案免费 ... 一秒拍照答题 ... 2024期末成绩查询入口 ... 免费查试卷答案网站2024 ...

    本站交流只代表网友个人观点,与本站立场无关
    欢迎反馈与建议,请联系电邮
    2024© 车视网