再學一次C語言吧#4

Multi tool use
Multi tool use
(function(w,d,s,l,i)w[l]=w[l])(window,document,'script','dataLayer','GTM-KDKMGT');
(function(d, s, id) var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/zh_TW/all.js#xfbml=1&appId=668497826514848"; fjs.parentNode.insertBefore(js, fjs); (document, 'script', 'facebook-jssdk'));






if(BAHAID)
BAHAID = BAHAID.replace(/&/g, "&")
.replace(/, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");

BAHAIDlow = BAHAID.toLowerCase();

document.write('');

document.write('

');
document.write('');
document.write('');
document.write('');
document.write('

');

//document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');


else
document.write('
');
document.write('');
document.write('
    ');
    document.write('
  • 我要登入
  • ');
    document.write('
  • 註冊
  • ');
    document.write('
  • ');
    document.write('
');
document.write('
');


document.write('
');

document.write(' ');

(function()
var cx = 'partner-pub-9012069346306566:kd3hd85io9c';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
)();

service = new rsearch('rsearch');

if( BAHAID )
NOTIFY_getnum();
run30 = setInterval("NOTIFY_getnum()",60000);


function insideSecondaryfunc(frm, evt){
if( 0

















breadCrumbs(122, '', 'homeuid=quickturtle')








    breadCrumbs_listMenu(122, 0, 'homeuid=quickturtle')





    創作內容





    0 GP


    再學一次C語言吧#4


    作者:CatuXian│2018-10-20 21:46:18│贊助:0│人氣:11

    字元的輸入

    字元的輸入有兩種方式,第一種就是使用最常見的scanf,在輸入的時候要注意,%後面的控制字元是用c,代表字元。第二種輸入方式是像這樣:ch= getchar()getchar()是用來接收使用者的輸入,然後將收到的字元傳入ch裡面。



    字元的輸出

    字元的輸出有兩種方式,第一種就跟上面一樣,是最常見的printf,在輸出的時候一樣要注意,控制字元要用c表示字元。第二種方式是像這樣:putchar(ch),括號裡面的ch就是要輸出的字元變數。



    陣列的宣告

    如果我們要宣告五個變數,分別存入不同的數值,這樣不就要宣告五個數值,豈不是很麻煩?這裡介紹陣列的使用方式,以字元陣列為例,宣告起來像這樣:charname[5]="abcd"; 5代表給他五個空間存入內容,這裡有個地方需要注意,雖然這裡宣告五個空間,不過實際上只有四個空間,因為其中一個要放NULL字元。



    輸出輸入字串的方式

    如果要輸出字串的話,控制字元為s

    那如果要限制輸入或者輸出的位置要怎麼辦呢?可以用以下的方式:


    printf("%s",&name[2]);//表示從字串的第二個位置輸出


    scanf("%s",&name[1]);//代表從字串的第一個位置輸入




    查詢字串長度
    使用strlen函式,用法像這樣:len=strlen(str);len是用來儲存字串長度的變數,str是字串的名稱。



    算數運算子

    用來進行+-*%等數學運算。



    關係運算子

    像是><=之類比較關係的運算子,比較需要注意的是=要使用==表示。



    if

    要是if後面的條件滿足了,就會執行後面的程式碼。


    ----------------------------------------------------------------------------------------------------------------------------



    參考書籍:無痛學習C/C++







    喜歡0
    收藏
    0
    引用
    0
    留言
    推上首頁



    檢舉








    引用網址:https://home.gamer.com.tw/TrackBack.php?sn=4168056

    All rights reserved. 版權所有,保留一切權利





    相關創作




    (翻譯) そこそこ平和なカルデアの日常-31




    (翻譯) 1108




    【神貓大盜】三大獎極●簡短見解




    繪師:魔太郎




    【紙娃娃】觸摸柔軟持久的黑兔耳朵


    留言共 0 篇留言




    Util.ChangeText('replys', Util.ChangeText.FLAG_LAZYLOAD|Util.ChangeText.FLAG_MAX_SIZE|Util.ChangeText.FLAG_BALA_PLAYER);

    我要留言提醒:您尚未登入,請先登入再留言


    0喜歡★quickturtle 可決定是否刪除您的留言,請勿發表違反站規文字。



    前一篇:再學一次C語言吧#3...








    egg('.MSG-list8C img').each(function(elem)
    elem.className = elem.className + ' lazyload';
    );

    egg('.gallery-image').imageGallery();

    function deleteCreation(vCode)
    var content = egg('.MSG-list8C').html();
    var pattern = /]*?>/i;
    var html = '
    確定要刪除嗎?';
    var width = '200px';
    if(content.match(pattern))
    html += '
    ';

    var boxConfig =
    'closeButton': false,
    'css':
    'width': width

    ;

    egg.mutbox(html, '訊息',
    '確定': function()
    if(egg('#chkDelTruthImage:checked').size())
    egg('[name=delTruthImage]').val('yes');


    egg.cookie.del('ckHOME_CREATION','home.gamer.com.tw','/');
    egg.cookie.set('ckHOME_CREATION',vCode,'home.gamer.com.tw','/');
    document.getElementById('frmDel').submit();
    egg.lightbox.close();
    ,
    '取消': function()
    egg.lightbox.close();

    ,boxConfig);

    var buttonOk = egg('.BH-popbtns :button:eq(0)');
    if(buttonOk.size())
    buttonOk.get(0).focus();



    resizeImage(627);

    egg('.btnGp').click(function()
    $.mutbox('請先登入才能進行此動作', '訊息', '確定':function()location.href='https://user.gamer.com.tw/login.php';);
    );







    訂閱私訊


    作品資料夾


    音樂 (0)

    吉他教學 (1)

    編曲軟體研究日誌 (0)


    程式 (0)

    C語言學習日誌 (4)


    遊戲引擎 (0)

    Unity學習日誌 (0)


    繪圖 (0)


    雜七雜八 (0)


    未分類 (0)


    smp030你~
    小屋更新更新~~看更多我要大聲說昨天20:23







    googletag.cmd.push(function() googletag.display('div-gpt-ad-1489070677458-0'); );



    (function(window, $)
    var $window = $(window);
    var $document = $(document);
    var $BH_slave = $("#BH-slave");
    var $BH_master = $("#BH-master");
    var $flySalve = $("#flySalve");
    var posY = $flySalve.position().top;
    var fad_style = document.getElementById("flySalve").style;
    var BH_wrapper_width = $('#BH-wrapper').width();
    var BH_topBar_height = $('.TOP-bh').height();
    $(window).on("scroll", function()
    posY = $BH_slave.height() - (fad_style.position === 'fixed' ? 0 : $flySalve.height());

    if ($document.scrollTop() > (posY + $BH_slave.offset().top - BH_topBar_height) && $BH_slave.height() < $BH_master.height())
    fad_style.position = 'fixed';
    fad_style.top = BH_topBar_height + 'px';
    if ($(window).width() < BH_wrapper_width)
    fad_style.left = (BH_wrapper_width - $BH_slave.width() - $document.scrollLeft())+'px';

    else
    fad_style.position = '';

    ).on("resize", function()
    fad_style.left = null;
    );
    )(window, jQuery);
















    face我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】





    The name of the picture黑色沙漠手遊伺服器是巴雷諾斯公會缺人名稱是GO歡迎大家查詢到後加入

    This page is only for reference, If you need detailed information, please check here
    The name of the pictureThe name of the picture

    Hx7 NbhDT7sAFDVfzU8fjnxGqXX2bdgLOrMf4tywbxqwm3Jgp1vb803
    K1vPbnmDv7BOw

    Popular posts from this blog

    【攻略】陳戈-謝勒汗智慧的古書 (完成)

    胡安·格里斯

    屏東縣