C语言刚刚学,这段看不懂,求大神逐个语句解释下 mod=(int)sqrt(i); =OFFSET($A$1,(ROW(A1)-1)*6+COL...
c\u8bed\u8a00\u4e2dmod\u51fd\u6570\u600e\u4e48\u5b9e\u73b0mod\u7684\u539f\u7406\u5c31\u662f\u6c42\u4f59\u6570\u3002
\u6bd4\u5982\uff1a10\u9664\u4ee53\uff0c\u5546\u662f3\uff0c\u4f59\u6570\u662f1
\u5728c++\u91cc\u9762\uff0c\u7528'/'\u8868\u793a\u6c42\u5546\uff0c\u800c\u7528%\u8868\u793a\u79cb\u4f59\u6570
\u6240\u4ee510/3=3\uff0c10%3=1\u3002
\u6269\u5c55\u8d44\u6599\uff1a
\u8bed\u6cd5\uff1a
MOD(number,divisor)
\u53c2\u6570\uff1a
Number \u4e3a\u88ab\u9664\u6570\u3002
Divisor \u4e3a\u9664\u6570\u3002
\u5728Oracle\u4e2d\uff0c\u5982\u679c divisor \u4e3a0\uff0c\u5219\u51fd\u6570\u76f4\u63a5\u8fd4\u56denumber\u3002
\u8bf4\u660e\uff1a
\u51fd\u6570MOD\u53ef\u4ee5\u501f\u7528\u51fd\u6570 INT \u6765\u8868\u793a\uff1a
MOD(n, d) = n - d*INT(n/d)
\u793a\u4f8b\uff1a
MOD(3, 2) \u7b49\u4e8e 1
MOD(-3, 2) \u7b49\u4e8e1
MOD(3, -2) \u7b49\u4e8e-1
MOD(-3, -2) \u7b49\u4e8e-1
MOD(-3, 0) \u7b49\u4e8e-3
MOD(3, 0) \u7b49\u4e8e3
MOD(2, 0) \u7b49\u4e8e2
MOD(4, 3) \u7b49\u4e8e1
\u800c\u5728Excel\u4e2d\uff0c\u9664\u6570\u4e0d\u80fd\u4e3a0\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002
MOD(3, -2) \u7b49\u4e8e-1(\u4e0e\u540e\u9762\u7684\u6570\u7b26\u53f7\u76f8\u540c)
MOD(3, 0) \u62a5\u9519\uff0c\u8f93\u51fa\u7ed3\u679c\u4e3a#DIV/0!
\u53c2\u8003\u8d44\u6599\uff1a
\u767e\u5ea6\u767e\u79d1-MOD\u51fd\u6570
\u7b80\u5355\u7684\u8bf4\uff0c \u5c31\u662f\u628aA\u5217\u7684\u6570\u636e \u8f6c\u4e3a4\u5217\uff0c\u6a2a\u5411\u653e\u7f6e, \u8f6c\u5230B :E \u5217, \u5047\u8bbe A1:A8\u4e3a 1 \uff0c2, \uff0c3 \uff0c4 \uff0c5\uff0c 6\uff0c 7 \uff0c8 B1\u8f93\u5165 =offset($A$1,column()-2+(row()-1)*4,0) \u53f3\u62c9\u5230E1\uff0c \u518d\u4e0b\u62c9\u516c\u5f0f B1 \u5f97\u52301 C1\u5f97\u52302 D1\u5f97\u52303 E1:4 B2:5 C2:6, D2:7 E2:8 \u4f9d\u6b64
mod=(int)sqrt(i); // 将根号i的值向下取整后赋值给变量mod
for(j=2;j<=mod;j++) // count统计[2,mod]之间能整除i的数
if(i%j==0)
count++;
if(count==0) // 如果从2到根号i没有能整除i的数,输出i
printf(" %d",i);
count=0;
所以这段代码的作用是,如果i是素数,输出i。
sqrt()是开平方的意思,然后再强转成int型。
绛旓細//灏卞嚭鏉ヤ簡a>b>c;濡傛灉b涓嶅ぇ浜c锛閭d箞鍒ゆ柇a鏄惁澶 浜c,濡傛灉a澶т簬c锛岄偅涔堝叧绯诲氨鏄痑>c>b :((a>c)?a //鍚岀悊鍒嗘瀽涓嬮潰鐨 :((b>c)?c:b));
绛旓細9&&锛-1锛夊洜涓轰袱杈归兘鏄湡鍊硷紙闈為浂鏁帮級锛屾墍浠ュ張鍙互鐪嬪仛1&&1锛&&鐨勪袱杈归兘鏄湡鍊硷紝鎵浠ユ渶缁堝间负鐪燂紝鍗崇粨鏋滀负1 锛侊紙a>b锛=锛侊紙3>4锛夊洜涓猴紙3>4锛夋槸閿欑殑锛屾墍浠ョ敤0琛ㄧず锛屽張鍥犱负鍓嶉潰锛侊紝鎵浠ョ敤1琛ㄧず 锛堬紒c锛夊洜涓篶=5锛屼笉绛変簬0锛屾墍浠鏄湡鍊硷紝鍓嶉潰鍔犱釜锛侊紝灏辫鏄庢暣浣撴槸鍋囧硷紝鎵浠ユ渶鍚庨昏緫鍊间负0...
绛旓細绗簩涓細~scanf 鎴戞槸娌¤杩囪繖绉嶇敤娉曠殑锛岀櫨搴︽煡浜嗕笅涔熸病鎵句釜锛屼功涓婃洿娌℃湁锛孋++涓瀯閫犲嚱鏁版墠鏈夎繖涓敤娉曪紝~scanf鏄敊璇敤娉曘傜涓変釜锛歝 = getchar锛堬級鏄幏鍙栦竴涓瓧绗︼紝鐒跺悗璧嬪肩粰瀛楃鍙橀噺c锛濡傛灉鍙槸getchar锛堬級锛涢偅涔堜粎浠呮槸鑾峰彇瀛楃锛岃屼笉鍋氬叾浠栫殑鎿嶄綔銆傚埄鐢ㄨ繖涓彲浠ヤ腑鏂绋嬪簭锛绛夊緟鐢ㄦ埛杈撳叆浠绘剰瀛楃鏃...
绛旓細鎴戠殑鐞嗚В鏄紝p>n鏃朵篃灏辨槸姣忎釜浜洪兘鎶ュ畬涓閬嶆暟锛岄浣嶈鎺ユ椂璁$畻涓嬩竴涓嚭鍦堢殑浜烘槸鍑犲彿锛屾瘮濡傝涓鍏10涓汉锛宮=3鐨勮瘽锛屾姤鍒9鍙峰嚭鍦堝悗锛孭=4*3锛屽簲璇10鍙峰厛鎶ヤ簡锛岃繕鍓㏄-N涓暟瑕佹姤锛(p-n-1)/(m-1)杩欎釜鏄妸涓婃鍑哄湀鐨勪汉闄ゅ幓锛岀畻鍑烘潵灏辨槸涓嬫瑕佸嚭鍦堢殑搴忓彿 ...
绛旓細p鏄竴涓瓧绗﹀瀷鐨勬寚閽堬紝鍥犳锛*p琛ㄧず鎸囬拡褰撳墠浣嶇疆鐨勫瓧绗︺傜敱浜嶤涓瀛楃鍨嬪拰鏁村瀷鏄笉杩涜鍖哄垎鐨勶紙鍗冲彲浠ヤ簰鐩歌浆鎹㈢殑锛夛紝鍥犳*p涔熷彲浠ヨ涓烘槸涓涓暟瀛椼傚悓鏍'0'涔熷彲浠ヤ唬琛ㄤ竴涓暟瀛椼傛牴鎹瓵SCII浠g爜琛ㄥ彲浠ョ煡閬撱傚瓧绗'0'浠g爜鏄崄杩涘埗鐨48,鎵绀轰篃鍙互璁や负'0'灏辨槸鏁板瓧48銆傚洜姝わ紝涓婇潰浠g爜鐨*p-'0'鐨勬剰鎬濆氨鏄...
绛旓細銆佸畬鏁寸殑C璇█缁撴瀯 涓涓畬鏁寸殑C璇█缁撴瀯鐢变互涓嬪嚑閮ㄥ垎缁勬垚锛氾紙1锛夊ご鏂囦欢锛氫綔涓轰竴绉嶅寘鍚姛鑳藉嚱鏁般佹暟鎹帴鍙e0鏄庣殑杞戒綋鏂囦欢锛屼富瑕佺敤浜庝繚瀛樼▼搴忕殑澹版槑锛岃屽畾涔夋枃浠剁敤浜庝繚瀛樼▼搴忕殑瀹炵幇銆傦紙2锛夊瓙鍑芥暟澹版槑锛氱敤浜庡0鏄庣敤鎴峰畾涔夌殑瀛愬嚱鏁般傚瓙鍑芥暟澹版槑鐢ㄤ簬鍦ㄧ▼搴忓紑澶村0鏄庣敤鎴疯嚜宸卞畾涔夌殑瀛愬嚱鏁帮紝鏈変竴绉嶇壒娈婃儏鍐垫槸涓嶉渶瑕...
绛旓細浼氬嚭鐜板皬鏁扮偣鐨 c=ch1; ///灏嗕竴涓猚har绫诲瀷璧嬪肩粰int锛屽湪0-255鑼冨洿鍐咃紝浣犲彲浠ヨ涓篶har灏辨槸int ch2=b; ///灏嗕竴涓猧nt璧嬪肩粰char锛322鏈夊彲鑳藉凡缁忚秴鍑篶har鎵鑳借〃绀虹殑鑼冨洿锛屾墍浠ヨ繖鏍疯祴鍊兼槸鍚堟硶浣嗘槸涓嶆纭殑銆俻rintf("%d,%f,%d,%c\n",a,x,c,ch2); //鎵撳嵃杈撳嚭 8,322.000000,107,B } ...
绛旓細灏辨槸涓涓畝鍗曟墤鍏嬬墝鐨勭偣鏁板拰鑺辫壊鐨勬惌閰嶃備竴寮犳墤鍏嬬墝鐢辫姳鑹诧紙suit锛夊拰鐐规暟锛坒ace锛夋瀯鎴愶紝杩欓噷鐢ㄤ竴涓粨鏋勪綋card琛ㄧず銆傜悊瑙d簡filldeck鍑芥暟閲岀殑2鍙ヨ瘽锛岃繖涓▼搴鍩烘湰灏辨槑鐧戒簡銆倃deck[i].face = wface[i%2];//鐐规暟鐨勫彇鍊兼柟寮 wdeck[i].suit = wsuit[i/2];//鑺辫壊鐨勫彇鍊兼柟寮 寰幆鎵ц杩囩▼锛歩 ...
绛旓細浣犲彲浠ュ埄鐢ㄧ幇鍦ㄥ凡缁忓浼氱殑涓閮ㄥ垎鐭ヨ瘑锛屽紑鍙戜竴涓嚜宸辨劅鍏磋叮鐨勮蒋浠讹紙骞朵笉鏄鍋氳蒋浠跺繀椤荤簿閫氳瑷锛岃繖灏卞儚瀛﹁嫳璇紝鍗婄敓涓嶇啛鐨勮瑷涔熷彲浠ュ啓鏂囩珷锛屽彧鏄篃璁告病鏈夐珮鎵嬪啓寰楅偅涔堝ソ鐪嬭屽凡锛屼絾鍒汉涓鏍风湅寰楁噦锛夈傛垨鑰呬拱鏈浘褰㈢晫闈㈢殑涔︼紙姣斿OpenGL鍏ラ棬浠涔堢殑锛岃繖浜涘浘褰㈢晫闈㈤兘鏄娇鐢C璇█鐨勶級锛屽仛涓涓畝鍗曠殑灏忔父鎴忥紙...
绛旓細鎴戠殑杩愯缁撴灉瀹屽叏涓嶄竴鏍凤細濂藉儚璺熺紪璇戝櫒鏈夊叧 姹傚ぇ绁炶В閲