C语言填空题
c\u8bed\u8a00\u586b\u7a7a\u98981.p!=person[3]
2.old=p->age
3.q->name,old
\u5f3a\u70c8\u7684\u72af\u7f6a\u611f
\u7b2c\u4e00\u9898
#include
main()
{ char b[]={'0','1','2','3','4','5','6','7','8','9',
'A','B','C','D','E','F',};
int c[64],d,i=0,base;
long n;
printf("enter a number :\n"); scanf("%ld",&n);
printf("enter new base :\n"); scanf("%d",&base);
do
{ c[i]= n%base ;
i++;
n= n/base ;
} while ( n != 0 );
printf("transmite new base:\n");
for (--i;i>=0;--i)
{ d=c[i];
printf("%c",b[d]);
}
printf("\n");
}
\u7b2c\u4e8c\u9898
#include
void main()
{
char s[]="12345678"; int v[4]={0,1,1,0},k,i;
for (k=0; s[k];k++)
{
switch ( s[k] )
{
case'1': i=0;
case'2': i=1;
case'3': i=2;
case'4': i=3;
}
v[i]=s[k]-'0';
}
for(k=0;k<4;k++) printf("%d ", v[k] );
}
\u7b2c\u4e09\u9898
#define N 15
#include
main()
{
int i,n;
float sum,f;
n=0;
sum=0;
printf("please input 15 numbers.\n");
for (i=1; i<=N ;i++)
{
scanf ("%f",&f);
if (f<=0) n-- ;
sum+=f;
n++ ;
}
printf("The sum of positive number is %d,and it's average is %f\n",n, sum/n );
}
0x3a: 00111010
--------------------------
~0x3a: 11000101
0x3a<<2: 11101000
------------------------- 取异或(^)
00101101
即十六进制的0x2d 即八进制 055
0x3A转化成二进制位111010,与~x异或就是111111,再左移两位就是111100,转换成八进制就是74.
运行下面的程序即可:
#include <stdio.h>
int
main( void ){
char x = 0x3a;
printf( "%o", ~x^x<<2 );
return 0;
}
所以结果是37777777455
这个结果是在64位机上得出的,
十六进制:2D
八进制:55
绛旓細1. 绗竴棰 int i=1,j=0;while(i++<3){ j++; } 绛旀锛歫=2,i=4 瑙i噴锛歩++ 鍔犲彿鍦╥ 鍚庨潰锛屽睘浜 鍚庡姞鍔狅紝灏辨槸鍏堟眰琛ㄨ揪寮忕殑缁撴灉锛岀劧鍚庡啀鍔1.绗1娆″惊鐜細鍒濆鍊糹=1 j=0锛岃〃杈惧紡 i<3 璁$畻缁撴灉涓篢RUE, 鎵цj++鍜宨+1 锛屾墽琛岀粨鏋滐細 i=2锛宩=1 绗2娆″惊鐜細i=2, 琛ㄨ揪寮廼<3 ...
绛旓細涓銆 鍗曢」閫夋嫨棰(姣忛2鍒,鍏20鍒)1銆佷互涓嬮夐」涓睘浜C璇█鐨勬暟鎹被鍨嬫槸( )A.澶嶆暟鍨 B.閫昏緫鍨 C.闆嗗悎鍨 D.鍙岀簿搴﹀瀷2銆佷竴涓狢绋嬪簭鐨勬墽琛屾槸浠( )A.main()鍑芥暟寮濮,鐩村埌main()鍑芥暟缁撴潫 B.绗竴涓嚱鏁板紑濮,鐩村埌鏈鍚庝竴涓嚱鏁扮粨鏉烠.绗竴涓鍙ュ紑濮,鐩村埌鏈鍚庝竴涓鍙ョ粨鏉 D.main()鍑芥暟寮濮,鐩村埌鏈鍚庝竴涓嚱鏁...
绛旓細6锛庡湪璋冪敤C璇█鐨勫簱鍑芥暟瀵瑰瓧绗︿覆杩涜鎿嶄綔鏃讹紝搴斿寘鍚殑澶存枃浠舵槸___string.h___銆
绛旓細璁$畻鏈轰簩绾c璇█鑰冭瘯棰樺瀷鏈夊崟椤归夋嫨棰樸佺▼搴濉┖棰銆佺▼搴忔敼閿欓銆佺▼搴忚璁¢鍥涘ぇ绫婚鍨嬨傚悇棰樺瀷鍒嗗煎涓嬶細涓銆佸崟椤归夋嫨棰 鍗曢」閫夋嫨棰樺叡鍥涘崄棰橈紝鍥涘崄鍒嗭紝姣忎竴涓夋嫨鍒嗗间负1鍒嗭紝鍏朵腑鍗曢」閫夋嫨涓惈鍏叡鍩虹鐭ヨ瘑锛岃閮ㄥ垎鍗侀亾棰橈紝鍗10鍒嗐備簩銆佺▼搴忓~绌洪 绋嬪簭濉┖棰樻湁2-3涓┖锛屽崰姣斿垎鍊18鍒嗭紝璇ラ鍨嬩负涓婃満棰...
绛旓細1銆佸涓嬬▼搴忕殑杈撳嚭缁撴灉鏄 c=3 銆俶ain( ){ int a=2,b=-1,c=3;if(a<b)if(b<0)c=0;else c++;printf(鈥渃=%d鈥,c);} else 鏄笌鍓嶉潰涓涓渶杩戠殑if瀵瑰簲鐨勶紝a=2锛宐=-1锛宎<b涓嶆垚绔嬶紝鍥犳鍚庨潰涓涓猧f--else---璇彞娌℃湁鎵ц锛宑鍊兼病鏈夋敼鍙樸2銆佹眰 1! + 2锛+3锛+---+10...
绛旓細1銆佷綆绾ц瑷鍒嗕负鏈哄櫒璇█ 鍜 姹囩紪璇█銆銆2銆佸父閲忔槸 鍦ㄨ繍琛岀▼搴忔湡闂达紝鍏跺间笉鑳借鏀瑰彉鐨勯噺 锛屽彉閲忔槸 鍦ㄨ繍琛岀▼搴忔湡闂达紝鍏跺艰兘琚敼鍙樼殑閲忋3銆佸瓧绗﹀父閲忎笌瀛楃涓插父閲忕殑鍖哄埆鍦ㄤ簬 瀛楃甯搁噺鐢ㄥ崟寮曞彿锛屽瓧绗︿覆甯搁噺鐢ㄥ弻寮曞彿 鍜 瀛楃涓插父閲忎笉鍙祴鍊 銆4銆C璇█鐨勭壒鐐规湁__鍙Щ妞嶆_銆佹湁鑷垜鎵╁睍鑳藉姏_...
绛旓細涓銆濉┖棰 1銆C璇█涓熀鏈殑鏁版嵁绫诲瀷鏈:___銆乢__ 銆乢__ . 2銆丆璇█涓櫘閫氭暣鍨嬪彉閲忕殑绫诲瀷璇存槑绗︿负___,鍦ㄥ唴瀛樹腑鍗燺__瀛楄妭,鏈夌鍙锋櫘閫氭暣鍨嬬殑鏁版嵁鑼冨洿鏄痏__ . 3銆佹暣鏁-35鍦ㄦ満鍐呯殑琛ョ爜琛ㄧず涓篲__. 4銆佹墽琛屼笅鍒楄鍙nt a=8; a+=a-=a*a; 鍚,a鐨勫兼槸___. 5銆佹湁濡備笅璇彞:char A[ ]={鈥淚...
绛旓細//word缂栬緫锛屽ぇ灏忓啓鍙兘鏈夐棶棰 涓銆濉┖棰 1銆佷竴涓C璇█绋嬪簭鐨勮鍙ヨ嚦灏戝簲鍖呭惈涓涓猒_鍑芥暟___銆2銆丆璇█婧愮▼搴忔枃浠剁殑鎵╁睍鍚嶆槸__ .C ___锛岀粡杩囩紪璇戙佽繛鎺ュ悗锛岀敓鎴愭枃浠剁殑鎵╁睍鍚嶆槸__缂栬瘧鍚庝负.obj 杩炴帴鍚庝负.exe ___銆3銆佺粨鏋勫寲绋嬪簭鐢 椤哄簭 銆乢__閫夋嫨___鍜宊__寰幆___涓夌鍩烘湰缁撴瀯缁勬垚銆
绛旓細浜屻 濉┖棰 1銆 C璇█鍑芥暟杩斿洖绫诲瀷鐨勯粯璁ゅ畾涔夌被鍨嬫槸 2銆 鍑芥暟鐨勫疄鍙備紶閫掑埌褰㈠弬鏈変袱绉嶆柟寮: 鍜 3銆佸湪涓涓嚱鏁板唴閮ㄨ皟鐢ㄥ彟涓涓嚱鏁扮殑璋冪敤鏂瑰紡绉颁负 銆傚湪涓涓嚱鏁板唴閮ㄧ洿鎺ユ垨闂存帴璋冪敤璇ュ嚱鏁版垚涓哄嚱鏁 鐨勮皟鐢ㄦ柟寮 4銆丆璇█鍙橀噺鎸夊叾浣滅敤鍩熷垎涓 鍜 5銆佸嚒鍦ㄥ嚱鏁颁腑鏈寚瀹氬瓨鍌ㄧ被鍒殑灞閮ㄥ彉閲,鍏堕粯璁ょ殑瀛樺偍绫诲埆涓 涓夈...
绛旓細鍏充簬C璇█鏁扮粍鐨勪竴浜濉┖棰 10 14涓嬮潰绋嬪簭鍙眰鍑虹煩闃 a 鐨勪袱鏉″瑙掔嚎涓婄殑鍏冪礌涔嬪拰,璇峰~绌 main() { int a[3][3]={1,3,6,7,9,11,14,15,17},sum1=0,sum2=0,i,j; for(i=0;i<3;i++) for(j=0;j<3;j++) if(i==j) sum1=sum1+a[i][j]; for(i=0;i<3;i++) for(銆1...