或和且的符号 c语言符号且与或
C\u8bed\u8a00\u91cc\u4e14\u548c\u6216\u662f\u4ec0\u4e48\u7b26\u53f7\u5206\u522b\u662f&&\u548c||\u3002
c\u8bed\u8a00\u4e2d\u7684&&\u6709\u4e09\u79cd\u4f7f\u7528\u65b9\u5f0f\u3002
1 \u3001\u53d6\u5730\u5740\u64cd\u4f5c\u7b26\u3002
\u5355\u76ee\u8fd0\u7b97\uff0c\u4e0e\u5176\u540e\u7684\u53d8\u91cf\u6216\u5e38\u91cf\u7ec4\u5408\uff0c\u7528\u4e8e\u83b7\u53d6\u8be5\u64cd\u4f5c\u6570\u7684\u5185\u5b58\u5730\u5740\u3002
2 \u3001\u4f4d\u64cd\u4f5c\u4e2d\u7684\u6309\u4f4d\u4e0e\u64cd\u4f5c
\u53cc\u76ee\u8fd0\u7b97\u7b26\uff0c&&\u7684\u4e24\u8fb9\u7684\u8868\u8fbe\u5f0f\u5747\u53c2\u4e0e\u64cd\u4f5c\u3002\u8ba1\u7b97\u65f6\u6309\u4f4d\u8ba1\u7b97\u3002\u5bf9\u4e8e\u4efb\u610f\u4e00\u4f4d\uff0c\u5982\u679c\u4e24\u4e2a\u64cd\u4f5c\u6570\u8be5\u4f4d\u4e0a\u7684\u503c\u5747\u4e3a1\uff0c\u5219\u7ed3\u679c\u8be5\u4f4d\u4e0a\u4e3a1\u3002\u5426\u5219\u7ed3\u679c\u8be5\u4f4d\u4e0a\u503c\u4e3a0\u3002
3 \u3001\u5f53\u4e24\u4e2a&&\u7b26\u53f7\u540c\u65f6\u4f7f\u7528\uff0c\u5373&&\u7b26\u53f7\u3002
\u5b83\u7684\u610f\u601d\u662f\u4ee3\u8868\u903b\u8f91\u8fd0\u7b97\u4e2d\u7684\u903b\u8f91\u4e0e\u3002\u53cc\u76ee\u8fd0\u7b97\u7b26\uff0c&&\u7684\u4e24\u8fb9\u7684\u8868\u8fbe\u5f0f\u5747\u53c2\u4e0e\u64cd\u4f5c\u3002
\u5f53&&\u4e24\u8fb9\u5747\u4e3a\u771f\u65f6\uff0c\u7ed3\u679c\u4e3a\u771f\u3002\u5426\u5219\u7ed3\u679c\u4e3a\u5047\u3002&&\u7531\u4e8e\u662f\u903b\u8f91\u8fd0\u7b97\uff0c\u7ed3\u679c\u53ea\u6709\u771f(1)\u6216\u5047(0)\u4e24\u79cd\u60c5\u51b5\u3002
\u6269\u5c55\u8d44\u6599
1\u3001\u5728\u4f7f\u7528&\u7684\u65f6\u5019\u8fdb\u884c\u76f8\u4e0e\u8fd0\u7b97\uff0c\u5f97\u5230\u7684\u7ed3\u679c\u4e00\u822c\u4e5f\u662f\u8fd9\u6837\uff0c\u4f46\u662f\u4e5f\u4f1a\u6709\u5076\u7136\u60c5\u51b5\uff0c\u4f8b\u598210\u548c5\u76f8\u4e0e\uff0c\u53731010&0101\uff0c\u5219\u7ed3\u679c\u4e3a0\uff0c\u8fd9\u65f6\u5019\u7684\u7ed3\u679c\u5c31\u662f\u4e0d\u4e00\u6837\u7684\u30022\u3001&&\u548c||\u5374\u662f\u903b\u8f91\u8fd0\u7b97\u7b26\uff0c\u9664\u4e860\u4e4b\u5916\uff0c\u5176\u4ed6\u7684\u975e\u96f6\u6574\u6570\u90fd\u53ef\u4ee5\u770b\u505atrue\uff0c\u5982\u679c10\u548c6\u76f8\u4e0e\uff0c\u7ed3\u679c\u4f1a\u662ftrue\u3002
C\u8bed\u8a00\u4e2d\u7684\u903b\u8f91\u8fd0\u7b97\u7b26\uff1a&&\uff08\u4e0e\u8fd0\u7b97\uff09\u3001||\uff08\u6216\u8fd0\u7b97\uff09\u3001!\uff08\u975e\u8fd0\u7b97\uff09\u3002
\u4e0e\u8fd0\u7b97\u7b26(&&)\u548c\u6216\u8fd0\u7b97\u7b26(||)\u5747\u4e3a\u53cc\u76ee\u8fd0\u7b97\u7b26\u3002\u5177\u6709\u5de6\u7ed3\u5408\u6027\u3002\u975e\u8fd0\u7b97\u7b26(!)\u4e3a\u5355\u76ee\u8fd0\u7b97\u7b26\uff0c\u5177\u6709\u53f3\u7ed3\u5408\u6027\u3002\u903b\u8f91\u8fd0\u7b97\u7b26\u548c\u5176\u5b83\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7\u7684\u5173\u7cfb\u53ef\u8868\u793a\u5982\u4e0b\uff1a
\u672c\u6765\u6ca1\u6709\u9519\u8bef\uff0c\u5173\u7cfb\u8fd0\u7b97\u7b26\u90fd\u662f\u6309\u201c\u975e\u4e0e\u6216\u201d\u987a\u5e8f\u6765\u8fd0\u7b97\u7684\u3002\u4f46\u662f\uff0c\u4e0d\u540c\u7684\u7f16\u8bd1\u5668\u8bbe\u8ba1\u8005\u53ef\u80fd\u5bf9\u8fd9\u4e2a\u7684\u8ba4\u8bc6\u4e0d\u540c\uff0c\u56e0\u6b64\uff0c\u5982\u679c\u4e0d\u52a0\u62ec\u53f7\u5c31\u4f1a\u6709\u6b67\u4e49\uff0c\u56e0\u6b64\uff0c\u7f16\u8bd1\u5668\u5c31\u4f1a\u63d0\u9192\u5e94\u8be5\u52a0\u62ec\u53f7\uff08\u7f16\u8bd1\u4e2d\u6709\u8b66\u544a\uff1awaring\uff09\uff0c\u4f46\u4f60\u4e0d\u52a0\uff0c\u4e5f\u4e0d\u7b97\u9519\uff0c\u53ea\u662f\u5176\u7ed3\u679c\u5c31\u662f\u6309\u7f16\u8bd1\u5668\u7684\u8fd0\u7b97\u987a\u5e8f\u6765\u64cd\u4f5c\u4e86\u3002
&&\u662f\u4e0e\uff0c||\u662f\u6216\uff1b
&\u662f\u4f4d\u4e0e\uff0c|\u662f\u4f4d\u6216\uff1b
|\u5c31\u662f\u6309\u4f4fshift\u5728\u6309\u56de\u8f66\u4e0a\u9762\u4e00\u4e2a\u6309\u94ae\uff1b
\u4e24\u4e0b\u5c31\u662f||\uff1b
\u8fd9\u4e2a\u4e0d\u662f\u9519\u8bef\uff0c\u662f\u8b66\u544awarning\uff0c\u7f16\u8bd1\u5668\u6015\u8bb0\u4e0d\u4f4f\u64cd\u4f5c\u7b26\u4f18\u5148\u7ea7\uff0c\u800c\u5bfc\u81f4\u9519\u8bef\uff0c\u56e0\u6b64\u63d0\u793a||\u7684\u4f18\u5148\u7ea7\u9ad8\u4e8e\uff01=\u3002
\u6269\u5c55\u8d44\u6599
C\u8bed\u8a00\u5185\u7f6e\u4e86\u4e30\u5bcc\u7684\u8fd0\u7b97\u7b26\uff0c\u5927\u4f53\u53ef\u5206\u4e3a10\u7c7b\uff1a\u7b97\u672f\u8fd0\u7b97\u7b26\u3001\u5173\u7cfb\u8fd0\u7b97\u7b26\u3001\u903b\u8f91\u8fd0\u7b97\u7b26\u3001\u4f4d\u64cd\u4f5c\u8fd0\u7b97\u7b26\u3001\u8d4b\u503c\u8fd0\u7b97\u7b26\u3001\u6761\u4ef6\u8fd0\u7b97\u7b26\u3001\u9017\u53f7\u8fd0\u7b97\u7b26\u3001\u6307\u9488\u8fd0\u7b97\u7b26\u3001\u6c42\u5b57\u8282\u6570\u8fd0\u7b97\u7b26\u548c\u7279\u6b8a\u8fd0\u7b97\u7b26\u3002
\u6839\u636e\u8fd0\u7b97\u7b26\u53ef\u64cd\u4f5c\u7684\u64cd\u4f5c\u6570\u7684\u4e2a\u6570\uff0c\u53ef\u628a\u8fd0\u7b97\u7b26\u5206\u4e3a\u4e00\u5143\u8fd0\u7b97\u7b26\u3001\u4e8c\u5143\u8fd0\u7b97\u7b26\u548c\u591a\u5143\u8fd0\u7b97\u7b26\uff08\u4e00\u822c\u4e09\u5143\uff09\u3002\u4f18\u5148\u7ea7\uff1a\u5f53\u4e0d\u540c\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7\u4e0d\u540c\u65f6\uff0c\u5148\u8ba1\u7b97\u8c01\u540e\u8ba1\u7b97\u7ed3\u5408\u6027\uff1a\u5f53\u4e0d\u540c\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7\u76f8\u540c\u65f6\uff0c\u5148\u8ba1\u7b97\u8c01\u540e\u8ba1\u7b97\u8c01\u3002
u. n
绛旓細鈥滀笖鈥濈殑绗﹀彿锛氣埀 鈥滄垨鈥濈殑绗﹀彿锛氣埁 1銆佸懡棰榩涓攓锛坧鈭锛夌殑鐪熷亣鐨勫垽瀹氾細2銆佸懡棰榩鎴杚锛坧鈭╭锛夌殑鐪熷亣鐨勫垽瀹氾細3銆佸懡棰橀潪P锛堚攼p锛夌殑鍒ゅ畾锛
绛旓細1. 涓旂殑绗﹀彿锛氣埀 鍦ㄦ暟瀛﹂昏緫涓紝绗﹀彿"鈭"浠h〃閫昏緫涓殑"涓"鍏崇郴銆傚畠琛ㄧず涓や釜鍛介閮藉繀椤绘垚绔嬶紝鎴栬呰涓や釜鏉′欢閮介渶瑕佹弧瓒炽備緥濡傦紝鍦ㄦ柟绋嬫眰瑙d腑锛屾垜浠粡甯搁亣鍒伴渶瑕佹弧瓒冲涓潯浠剁殑鎯呭喌锛岃繖鏃跺氨鍙互浣跨敤鈥滀笖鈥濇潵杩炴帴杩欎簺鏉′欢銆備緥濡傦細鈥渪 > 2 涓 x < 5鈥濓紝杩欐剰鍛崇潃x鐨勫兼棦瑕佸ぇ浜2锛屽張瑕佸皬浜5銆2. ...
绛旓細鎴栨槸鈥溾埅鈥濓紝涓旀槸鈥溾埄鈥锛屽拰娌℃湁琛ㄧず銆傜粰瀹氫袱涓泦鍚圓锛孊锛屾妸浠栦滑鎵鏈夌殑鍏冪礌鍚堝苟鍦ㄤ竴璧风粍鎴愮殑闆嗗悎锛屽彨鍋氶泦鍚圓涓庨泦鍚圔鐨勫苟闆嗭紝璁颁綔A鈭狟锛岃浣淎骞禕銆傞泦鍚堣涓紝璁続锛孊鏄袱涓泦鍚堬紝鐢辨墍鏈夊睘浜庨泦鍚圓涓斿睘浜庨泦鍚圔鐨勫厓绱犳墍缁勬垚鐨勯泦鍚堬紝鍙仛闆嗗悎A涓庨泦鍚圔鐨勪氦闆嗭紙intersection锛夛紝璁颁綔A鈭〣銆傦紙1锛夐泦鍚 ...
绛旓細濡傛灉鐢ˋ,B琛ㄧず涓や釜鏉′欢锛鈥滄垨鈥濈敤A 鈭 B琛ㄧず锛"涓"鐢ˋ 鈭 B琛ㄧず銆
绛旓細鎴栨槸鈥溾埅鈥濓紝涓旀槸鈥溾埄鈥銆傚湪鏁板涓妸鐢ㄨ瑷銆佺鍙锋垨寮忓瓙琛ㄨ揪鐨勶紝鍙互鍒ゆ柇鐪熷亣鐨勯檲杩板彞鍙仛鍛介銆傜湡鍛介灏辨槸姝g‘鐨勫懡棰橈紝鍗冲鏋滃懡棰樼殑棰樿鎴愮珛锛岄偅涔堢粨璁轰竴瀹氭垚绔嬨傚锛氣憼涓ゆ潯骞宠绾胯绗笁鏉$洿绾挎墍鎴紝鍐呴敊瑙掔浉绛夈傗憽濡傛灉a>b锛宐>c閭d箞a>c銆傗憿瀵归《瑙掔浉绛夈傚畾鐞 瀹氱悊鏄牴鎹叕鐞嗘垨宸茬煡鐨勫畾鐞嗘帹瀵煎嚭鏉ョ殑...
绛旓細鈥滄垨鈥濇槸 鈥溾埅鈥,鈥滀笖鈥濇槸鈥溾埄鈥濆笇鏈涜兘甯埌浣
绛旓細鏄惁瀹氥傚悎鍙栥傛瀽鍙栥傗溾埁鈥濇槸鎴栫殑鎰忔濓紝鐩稿綋浜庨泦鍚堜腑鐨勫苟闆嗭紝鍛介P鈭≦鐨勭湡鍋囦篃涓P锛孮鐨勭湡鍋囨湁鍏筹紝褰揚锛孮鍏ㄦ槸鍋囧懡棰樻椂锛屽懡棰楶鈭≦涓哄亣鍛介锛屽叾浠栭兘鏄湡鍛介銆傗溾埀鈥濇槸涓旂殑鎰忔濓紝鐩稿綋浜庨泦鍚堜腑鐨勪氦闆嗭紝鍛介P鈭鐨勭湡鍋囦笌P锛孮鐨勭湡鍋囨湁鍏筹紝褰揚锛孮鍏ㄦ槸鐪熷懡棰樻椂锛屽懡棰楶鈭涓虹湡鍛介锛屽叾浠栭兘鏄亣...
绛旓細鎴栵細V锛屼笖锛歏鍊掕繃鏉
绛旓細1銆侀鍏堝湪閿洏涓婃寜涓媠hift閿紝涓嶈鏉惧紑锛屽鍥句腑绾㈡鍦堜腑鎵绀烘寜閿細2銆佺劧鍚庡湪閿洏涓婃寜涓嬪洖杞nter閿乏杈圭殑閿紙閿洏涓嶅悓浣嶇疆鏈夋墍涓嶅悓锛屼篃鍙兘鍦ㄤ笂闈級锛屽弻绔栫嚎鍜屽彸鏂滅嚎鍏卞悓鎵鍦ㄧ殑鎸夐敭锛屽鍥剧孩妗嗗湀涓墍绀猴細3銆佹寜浠ヤ笂鎿嶄綔姝ラ鎸変笅鍚庡氨浼氬嚭鏉ヤ竴涓 | 绗﹀彿锛屼笉瑕佹澗寮shift閿紝鍐嶆寜涓娆″弻绔栫嚎鍜屽彸鏂滅嚎鍏卞悓...
绛旓細鈥溾埀鈥濇槸涓旂殑鎰忔濓紝鈥溾埁鈥濇槸鎴鐨勬剰鎬濄傝繖鏄暟瀛﹂昏緫绗﹀彿锛岃繛鎺ヤ袱涓畝鍗曞懡棰樼敤鐨勶紝鈥溾埀鈥濇槸涓旂殑鎰忔濓紝鐩稿綋浜庨泦鍚堜腑鐨勪氦闆嗭紝鍛介P鈭鐨勭湡鍋囦笌P锛孮鐨勭湡鍋囨湁鍏筹紝褰揚锛孮鍏ㄦ槸鐪熷懡棰樻椂锛屽懡棰楶鈭涓虹湡鍛介锛屽叾浠栭兘鏄亣鍛介銆傗溾埁鈥濇槸鎴栫殑鎰忔濓紝鐩稿綋浜庨泦鍚堜腑鐨勫苟闆嗭紝鍛介P鈭≦鐨勭湡鍋囦篃涓嶱锛孮鐨勭湡鍋囨湁...