close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
How to Make, Market, and Sell eBooks

Essential and free e-publishing methods to market ebooks at major retailers and personal sites/blogs. Sign up for this online course for just $29.
From our sponsors
程式語言的作業
Jan 14th 2014, 14:36

知識問題|

發問者: EMAH汲無蹤 ( 初學者 5 級)
發問時間: 2014-01-14 22:36:21 ( 還有 9 天發問到期 )
解答贈點: 17 ( 共有 1 人贊助 )
回答: 0 0

這是我的題目::
設計一程式讓使用者輸入2~10個英文單字,輸出時所有字串裡的'a','b','c','d','e'字元都轉為大寫,其餘都為小寫。
而這程式要用C#寫的

  • 2014-01-14 22:41:46 補充

    private void button1_Click(object sender, EventArgs e)
    {
    int d = 'a' - 'A';
    string[] a = textBox1.Text.Split(',');

    if (a.Length >= 2 && a.Length <= 10)

  • 2014-01-14 22:42:12 補充

    {
    label1.Text = "";
    for (int i = 0; i < a.Length; i++)

  • 2014-01-14 22:42:22 補充

    {
    string h = a[i];

    for (int j = 0; j < h.Length; j++)

  • 2014-01-14 22:42:45 補充

    {

    if (h[j] == 'a' || h[j] == 'b' || h[j] == 'c' || h[j] == 'd' || h[j] == 'e')

    label1.Text += (h[j] >= 'a' && h[j] <= 'z') ? (char)(h[j] - d) : h[j];

  • 2014-01-14 22:42:58 補充

    else
    label1.Text += (h[j] >= 'a' && h[j] <= 'Z') ? (char)(h[j] + d) : h[j];
    }
    label1.Text += "";

  • 2014-01-14 22:44:14 補充

    以上是我的程式碼 而其中的問題是程式只完成了'a','b','c','d','e'字元都轉為大寫 但其餘都為小寫這個部分還有問題

馬上按讚  加入 Yahoo! 奇摩 知識+  粉絲團

最新C&C++

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 koassq 的頭像
    koassq

    線上遊戲排行榜2013/2014,進擊的巨人線上看,candy crush saga外掛,正妹寫真三圍

    koassq 發表在 痞客邦 留言(0) 人氣()