PDA

View Full Version : xin giúp đỡ về bài tập mãng



lutrihai
18-05-2011, 16:50
1/Nhập bất kỳ một đoạn text vd : TRAN THI HOA và xuất ra cá kết quả như sau:
a.TRAN THI HOA
b.tran thi hoa
c.Tran Thi Hoa

E mới học C# nên còn gà mong mọi người giúp đỡ

bientho88
20-05-2011, 01:42
<code>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chuoi
{
class Program
{
static void Main(string[] args)
{
Console.Write("Nhap: ");
string str = Console.ReadLine();
Console.WriteLine(str.ToUpper());
Console.WriteLine(str.ToLower());
string str1 = str.ToLower();
string[] mang = str1.Split(' ');

string str2 = "";
for (int i = 0; i < mang.Length; i++)
{
str2 += mang[i].Substring(0, 1).ToString().ToUpper() + mang[i].Substring(1).ToString()+" ";

}
Console.WriteLine(str2);
Console.ReadKey();
}
}
}

</code>