Trang 3 của 4 Đầu tiênĐầu tiên 1234 CuốiCuối
Kết quả 21 đến 30 của 40
  1. #21
    Ngày tham gia
    May 2015
    Đang ở
    TPHCM
    Bài viết
    0
    Mã nguồn PHP:
    [color=#000000]
    [/color][color=#007700]public class [/color][color=#0000bb]btchuoi3 [/color][color=#007700]{ private [/color][color=#0000bb]string name[/color][color=#007700][]; [/color][color=#0000bb]void input[/color][color=#007700]() { [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]scanner t [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); try { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap so hoc sinh:"[/color][color=#007700]); [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]t[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"erro:" [/color][color=#007700]+ [/color][color=#0000bb]e[/color][color=#007700].[/color][color=#0000bb]tostring[/color][color=#007700]()); } [/color][color=#0000bb]t[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]name [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap ho va ten hoc sinh " [/color][color=#007700]+ ([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]) + [/color][color=#dd0000]" :"[/color][color=#007700]); [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]t[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } [/color][color=#0000bb]void output[/color][color=#007700]() { for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"hoc sinh " [/color][color=#007700]+ ([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]) + [/color][color=#dd0000]" :" [/color][color=#007700]+ [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } [/color][color=#0000bb]void sapxep[/color][color=#007700]() { for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< ([/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700]); [/color][color=#0000bb]i[/color][color=#007700]++) { for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { [/color][color=#0000bb]string tem [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]; [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]; [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]tem[/color][color=#007700]; } } [/color][color=#0000bb]output[/color][color=#007700](); } [/color][color=#0000bb]void seach[/color][color=#007700]() { [/color][color=#0000bb]scanner t [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]string a[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"enter key word need found:"[/color][color=#007700]); [/color][color=#0000bb]a [/color][color=#007700]= [/color][color=#0000bb]t[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700]) != -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"found key word:" [/color][color=#007700]+ [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } } public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]btchuoi3 bt [/color][color=#007700]= new [/color][color=#0000bb]btchuoi3[/color][color=#007700](); [/color][color=#0000bb]bt[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]bt[/color][color=#007700].[/color][color=#0000bb]sapxep[/color][color=#007700](); [/color][color=#0000bb]bt[/color][color=#007700].[/color][color=#0000bb]seach[/color][color=#007700](); }}[/color] 
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote></blockquote></div>
    </div>
    </div>

  2. #22
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    chia sẻ với các bạn về so sánh chuỗi ,
    có những lúc trong lập trình việc so sánh chuỗi không cẩn thận sẽ làm crash app như sau :
    if(str1.equals(" "))
    {
    // do something
    }
    như vậy nếu str1 null thì sẽ có lỗi xảy ra , tốt nhất là thế này :
    if((" ").equals(str1))
    {
    // do something
    }

  3. #23
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    bài này tuy dài nhưng mình nghĩ là full..

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>class hocsinh (move your mouse to reveal the content)</noscript>

    class hocsinh (open)
    class hocsinh (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    [/color][color=#ff8000]/* * to change this license header, choose license headers in project properties. * to change this template file, choose tools | templates * and open the template in the editor. */[/color][color=#0000bb]package bai25sosanhchuoi[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]stringtokenizer[/color][color=#007700]; [/color][color=#ff8000]/** * * @author admin */[/color][color=#007700]public class [/color][color=#0000bb]hocsinh [/color][color=#007700]{ private [/color][color=#0000bb]int sohocsinh[/color][color=#007700]; private [/color][color=#0000bb]string name[/color][color=#007700][]; [/color][color=#0000bb]scanner nhap [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]boolean check [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; public [/color][color=#0000bb]void input[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập số sinh viên: "[/color][color=#007700]); while (![/color][color=#0000bb]check[/color][color=#007700]) { try { [/color][color=#0000bb]sohocsinh [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập sai. nhập lại: "[/color][color=#007700]); [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]name [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]sohocsinh[/color][color=#007700]]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập họ tên sinh viên thứ " [/color][color=#007700]+ ([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]) + [/color][color=#dd0000]":"[/color][color=#007700]); [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]chuanhoa[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); while (![/color][color=#0000bb]check[/color][color=#007700]) { if (![/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]isempty[/color][color=#007700]()) { [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; } else { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập sai, nhập lại: "[/color][color=#007700]); [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]chuanhoa[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); } } } } [/color][color=#ff8000]// hiển thị danh sách học sinh [/color][color=#007700]public [/color][color=#0000bb]void show[/color][color=#007700]() { for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700](([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]) + [/color][color=#dd0000]". " [/color][color=#007700]+ [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } [/color][color=#ff8000]// đảo tên [/color][color=#007700]public [/color][color=#0000bb]string daoten[/color][color=#007700]([/color][color=#0000bb]string name[/color][color=#007700]) { [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]sp [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]split[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]); [/color][color=#0000bb]stringbuilder name2 [/color][color=#007700]= new [/color][color=#0000bb]stringbuilder[/color][color=#007700](); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]length [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]>= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]--) { [/color][color=#0000bb]name2[/color][color=#007700].[/color][color=#0000bb]append[/color][color=#007700]([/color][color=#0000bb]sp[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } return [/color][color=#0000bb]name2 [/color][color=#007700]+ [/color][color=#dd0000]""[/color][color=#007700]; } [/color][color=#ff8000]// sắp xếp theo thứ tự a,b,c [/color][color=#007700]public [/color][color=#0000bb]void sapxep[/color][color=#007700]() { for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { if ([/color][color=#0000bb]daoten[/color][color=#007700]([/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]).[/color][color=#0000bb]comparetoignorecase[/color][color=#007700]([/color][color=#0000bb]daoten[/color][color=#007700]([/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]])) < [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]string temp [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]; [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]; [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]temp[/color][color=#007700]; } } } } public [/color][color=#0000bb]string chuanhoa[/color][color=#007700]([/color][color=#0000bb]string name[/color][color=#007700]) { [/color][color=#0000bb]stringbuilder buil [/color][color=#007700]= new [/color][color=#0000bb]stringbuilder[/color][color=#007700](); for ([/color][color=#0000bb]stringtokenizer stringtokenizer [/color][color=#007700]= new [/color][color=#0000bb]stringtokenizer[/color][color=#007700]([/color][color=#0000bb]name[/color][color=#007700]); [/color][color=#0000bb]stringtokenizer[/color][color=#007700].[/color][color=#0000bb]hasmoretokens[/color][color=#007700]();) { [/color][color=#0000bb]string token [/color][color=#007700]= [/color][color=#0000bb]stringtokenizer[/color][color=#007700].[/color][color=#0000bb]nexttoken[/color][color=#007700](); [/color][color=#0000bb]buil[/color][color=#007700].[/color][color=#0000bb]append[/color][color=#007700]([/color][color=#0000bb]token[/color][color=#007700].[/color][color=#0000bb]substring[/color][color=#007700]([/color][color=#0000bb]0[/color][color=#007700], [/color][color=#0000bb]1[/color][color=#007700]).[/color][color=#0000bb]touppercase[/color][color=#007700]()).[/color][color=#0000bb]append[/color][color=#007700]([/color][color=#0000bb]token[/color][color=#007700].[/color][color=#0000bb]substring[/color][color=#007700]([/color][color=#0000bb]1[/color][color=#007700]).[/color][color=#0000bb]tolowercase[/color][color=#007700]()).[/color][color=#0000bb]append[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]); } return [/color][color=#0000bb]buil[/color][color=#007700].[/color][color=#0000bb]tostring[/color][color=#007700]().[/color][color=#0000bb]trim[/color][color=#007700](); } public [/color][color=#0000bb]void timkiem[/color][color=#007700]() { [/color][color=#0000bb]string tukhoa [/color][color=#007700]= [/color][color=#dd0000]""[/color][color=#007700]; [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập từ khóa tìm kiếm: "[/color][color=#007700]); [/color][color=#0000bb]tukhoa [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); while (![/color][color=#0000bb]check[/color][color=#007700]) { if (![/color][color=#0000bb]tukhoa[/color][color=#007700].[/color][color=#0000bb]isempty[/color][color=#007700]()) { [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; }else{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập sai, nhập lại: "[/color][color=#007700]); [/color][color=#0000bb]tukhoa [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"kết quả tìm kiếm: "[/color][color=#007700]); [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]tolowercase[/color][color=#007700]().[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]tukhoa[/color][color=#007700].[/color][color=#0000bb]tolowercase[/color][color=#007700]()) != -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700](([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]) + [/color][color=#dd0000]". " [/color][color=#007700]+ [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; } } if (![/color][color=#0000bb]check[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"không tìm thấy"[/color][color=#007700]); } }}[/color] 
    </blockquote></div>
    </div>
    </div>

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>class main (move your mouse to reveal the content)</noscript>

    class main (open)
    class main (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    [/color][color=#007700]public class [/color][color=#0000bb]main [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]hocsinh hs[/color][color=#007700]=new [/color][color=#0000bb]hocsinh[/color][color=#007700](); [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"danh sách học sinh đã nhập:"[/color][color=#007700]); [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]show[/color][color=#007700](); [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]sapxep[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"danh sách sinh viên đã sắp xếp: "[/color][color=#007700]); [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]show[/color][color=#007700](); [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]timkiem[/color][color=#007700](); }}[/color] 
    </blockquote></div>
    </div>
    </div>

  4. #24
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    bài của mình:
    - nhập tên học sinh
    - sắp xếp tên (tên có 3 kí tự)
    - tìm kiếm tên

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>hovatensearch (move your mouse to reveal the content)</noscript>

    hovatensearch (open)
    hovatensearch (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>

    Mã nguồn PHP:
    [color=#000000]
    package hoc[/color][color=#007700].[/color][color=#0000bb]java[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];public class [/color][color=#0000bb]sosanhstring [/color][color=#007700]{private static [/color][color=#0000bb]int havevalue [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) {[/color][color=#0000bb]scanner in [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap so hoc sinh: "[/color][color=#007700]);[/color][color=#0000bb]int soluong [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]hocsinhstring[/color][color=#007700][] [/color][color=#0000bb]hs [/color][color=#007700]= new [/color][color=#0000bb]hocsinhstring[/color][color=#007700][[/color][color=#0000bb]soluong[/color][color=#007700]];[/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) {[/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = new [/color][color=#0000bb]hocsinhstring[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap ten hoc sinh so: " [/color][color=#007700]+ ([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]));[/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]sethovaten[/color][color=#007700]([/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]());}for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]length [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) {for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) {[/color][color=#0000bb]string temp[/color][color=#007700];if ([/color][color=#0000bb]sosanh[/color][color=#007700]([/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]gethovaten[/color][color=#007700](), [/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]].[/color][color=#0000bb]gethovaten[/color][color=#007700]()) > [/color][color=#0000bb]0[/color][color=#007700]) {[/color][color=#0000bb]temp [/color][color=#007700]= [/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]gethovaten[/color][color=#007700]();[/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]sethovaten[/color][color=#007700]([/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]].[/color][color=#0000bb]gethovaten[/color][color=#007700]());[/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]].[/color][color=#0000bb]sethovaten[/color][color=#007700]([/color][color=#0000bb]temp[/color][color=#007700]); }}}[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ten hoc sau khi sap xep: "[/color][color=#007700]);for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]gethovaten[/color][color=#007700]()); }[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"moi ban nhap ten hoc sinh can tim: "[/color][color=#007700]);[/color][color=#0000bb]string search [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) {[/color][color=#0000bb]search[/color][color=#007700]([/color][color=#0000bb]search[/color][color=#007700], [/color][color=#0000bb]hs[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]gethovaten[/color][color=#007700]());}if ([/color][color=#0000bb]havevalue [/color][color=#007700]== [/color][color=#0000bb]0[/color][color=#007700]) {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"khong co hoc sinh can tim"[/color][color=#007700]);}} public static [/color][color=#0000bb]int sosanh[/color][color=#007700]([/color][color=#0000bb]string str1[/color][color=#007700], [/color][color=#0000bb]string str2[/color][color=#007700]) {[/color][color=#0000bb]string arrhoten1[/color][color=#007700][], [/color][color=#0000bb]arrhoten2[/color][color=#007700][];[/color][color=#0000bb]int sokitu1[/color][color=#007700], [/color][color=#0000bb]sokitu2[/color][color=#007700];[/color][color=#0000bb]arrhoten1 [/color][color=#007700]= [/color][color=#0000bb]str1[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]split[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]);[/color][color=#0000bb]arrhoten2 [/color][color=#007700]= [/color][color=#0000bb]str2[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]split[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]);[/color][color=#0000bb]sokitu1 [/color][color=#007700]= [/color][color=#0000bb]arrhoten1[/color][color=#007700].[/color][color=#0000bb]length [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700];[/color][color=#0000bb]sokitu2 [/color][color=#007700]= [/color][color=#0000bb]arrhoten2[/color][color=#007700].[/color][color=#0000bb]length [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700];return [/color][color=#0000bb]arrhoten1[/color][color=#007700][[/color][color=#0000bb]sokitu1[/color][color=#007700]].[/color][color=#0000bb]comparetoignorecase[/color][color=#007700]([/color][color=#0000bb]arrhoten2[/color][color=#007700][[/color][color=#0000bb]sokitu2[/color][color=#007700]]);} public static [/color][color=#0000bb]void search[/color][color=#007700]([/color][color=#0000bb]string str1[/color][color=#007700], [/color][color=#0000bb]string str2[/color][color=#007700]) {[/color][color=#0000bb]string temp1 [/color][color=#007700]= [/color][color=#0000bb]str1[/color][color=#007700].[/color][color=#0000bb]tolowercase[/color][color=#007700]();[/color][color=#0000bb]string temp2 [/color][color=#007700]= [/color][color=#0000bb]str2[/color][color=#007700].[/color][color=#0000bb]tolowercase[/color][color=#007700](); if ([/color][color=#0000bb]temp2[/color][color=#007700].[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]temp1[/color][color=#007700]) != -[/color][color=#0000bb]1[/color][color=#007700]) {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]str2[/color][color=#007700]);[/color][color=#0000bb]havevalue[/color][color=#007700]++;}} } class [/color][color=#0000bb]hocsinhstring [/color][color=#007700]{private [/color][color=#0000bb]string hovaten[/color][color=#007700]; public [/color][color=#0000bb]void sethovaten[/color][color=#007700]([/color][color=#0000bb]string hovaten[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hovaten [/color][color=#007700]= [/color][color=#0000bb]hovaten[/color][color=#007700];} public [/color][color=#0000bb]string gethovaten[/color][color=#007700]() {return [/color][color=#0000bb]hovaten[/color][color=#007700];}}[/color] 
    </blockquote></div>
    </div>
    </div>

  5. #25
    Ngày tham gia
    May 2015
    Bài viết
    0
    Mã nguồn PHP:
    [color=#000000]
    package string[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];public class [/color][color=#0000bb]exercise2 [/color][color=#007700]{static [/color][color=#0000bb]scanner inp[/color][color=#007700]=new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) {[/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]ten[/color][color=#007700]=new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]10[/color][color=#007700]];[/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]ho[/color][color=#007700]=new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]10[/color][color=#007700]];[/color][color=#0000bb]int x[/color][color=#007700];[/color][color=#ff8000]//part: input[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"let's put number of student: x=
    "[/color][color=#007700]);[/color][color=#0000bb]x[/color][color=#007700]=[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]inp[/color][color=#007700]=new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);for([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]x[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"let's put name of student:
    "[/color][color=#007700]);[/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]=[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"let'
    s put last name of student:
    "[/color][color=#007700]);[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]=[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();}[/color][color=#ff8000]//part 2: change[/color][color=#007700]for([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]<([/color][color=#0000bb]x[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700]);[/color][color=#0000bb]i[/color][color=#007700]++)for([/color][color=#0000bb]int j[/color][color=#007700]=[/color][color=#0000bb]x[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700];[/color][color=#0000bb]j[/color][color=#007700]>[/color][color=#0000bb]i[/color][color=#007700];[/color][color=#0000bb]j[/color][color=#007700]--){if([/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]comparetoignorecase[/color][color=#007700]([/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]])>-[/color][color=#0000bb]1[/color][color=#007700]){[/color][color=#0000bb]string n[/color][color=#007700]=new [/color][color=#0000bb]string[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]);[/color][color=#0000bb]string ln[/color][color=#007700]=new [/color][color=#0000bb]string[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]);[/color][color=#0000bb]n[/color][color=#007700]=[/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]];[/color][color=#0000bb]ln[/color][color=#007700]=[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]];[/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]=[/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]];[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]=[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]];[/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]=[/color][color=#0000bb]n[/color][color=#007700];[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]=[/color][color=#0000bb]ln[/color][color=#007700];[/color][color=#ff8000]//so sanh ho[/color][color=#007700]if([/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]comparetoignorecase[/color][color=#007700]([/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]])==[/color][color=#0000bb]0[/color][color=#007700])if([/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]comparetoignorecase[/color][color=#007700]([/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]])>-[/color][color=#0000bb]1[/color][color=#007700]){[/color][color=#0000bb]string ln2[/color][color=#007700]=new [/color][color=#0000bb]string[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]);[/color][color=#0000bb]ln2[/color][color=#007700]=[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]];[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]=[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]];[/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]=[/color][color=#0000bb]ln2[/color][color=#007700];}}} for([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]x[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++)[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]+[/color][color=#dd0000]" "[/color][color=#007700]+[/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]);[/color][color=#ff8000]//part 3: search[/color][color=#0000bb]string search[/color][color=#007700]=new [/color][color=#0000bb]string[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"what's the word you want to search?
    "[/color][color=#007700]);[/color][color=#0000bb]search[/color][color=#007700]=[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();for([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]x[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++)if([/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]equalsignorecase[/color][color=#007700]([/color][color=#0000bb]search[/color][color=#007700])||[/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]equalsignorecase[/color][color=#007700]([/color][color=#0000bb]search[/color][color=#007700]))[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]ho[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]+[/color][color=#dd0000]" "[/color][color=#007700]+[/color][color=#0000bb]ten[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]);}}[/color] 

  6. #26
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>b1 (move your mouse to reveal the content)</noscript>

    b1 (open)
    b1 (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    package edu[/color][color=#007700].[/color][color=#0000bb]dragon[/color][color=#007700].[/color][color=#0000bb]oop[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]ssten [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]hs hs [/color][color=#007700]= new [/color][color=#0000bb]hs[/color][color=#007700](); [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]output[/color][color=#007700](); [/color][color=#ff8000]// hs.sapxep(); // hs.output(); [/color][color=#0000bb]hs[/color][color=#007700].[/color][color=#0000bb]timkiem[/color][color=#007700]([/color][color=#dd0000]"hoang"[/color][color=#007700]); }} class [/color][color=#0000bb]hs [/color][color=#007700]{ private [/color][color=#0000bb]string name[/color][color=#007700][]; private [/color][color=#0000bb]int n[/color][color=#007700]; [/color][color=#0000bb]scanner in [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); public [/color][color=#0000bb]hs[/color][color=#007700]() { [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]name [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; } public [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]getname[/color][color=#007700]() { return [/color][color=#0000bb]name[/color][color=#007700]; } public [/color][color=#0000bb]void setname[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]name[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700]; } public [/color][color=#0000bb]int getn[/color][color=#007700]() { return [/color][color=#0000bb]n[/color][color=#007700]; } public [/color][color=#0000bb]void setn[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]n[/color][color=#007700]; } public [/color][color=#0000bb]void input[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập n:"[/color][color=#007700]); [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]name [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập tên sinh viên thứ " [/color][color=#007700]+ ([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]) + [/color][color=#dd0000]":"[/color][color=#007700]); [/color][color=#0000bb]name [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } public [/color][color=#0000bb]void output[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"danh sach hoc sinh!!!"[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên thứ:" [/color][color=#007700]+ [/color][color=#0000bb]name[/color][color=#007700]); } } public [/color][color=#0000bb]void sapxep[/color][color=#007700]() { [/color][color=#0000bb]int i[/color][color=#007700], [/color][color=#0000bb]j[/color][color=#007700]; for ([/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { for ([/color][color=#0000bb]j [/color][color=#007700]= [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { if ([/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]compareto[/color][color=#007700]([/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]) == -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]string temp [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700]; [/color][color=#0000bb]name [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]; [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]temp[/color][color=#007700]; } } } } public [/color][color=#0000bb]void timkiem[/color][color=#007700]([/color][color=#0000bb]string s[/color][color=#007700]) { [/color][color=#0000bb]int i[/color][color=#007700], [/color][color=#0000bb]count [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; for ([/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]name[/color][color=#007700].[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]s[/color][color=#007700]) != -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]name[/color][color=#007700]); [/color][color=#0000bb]count[/color][color=#007700]++; } } if ([/color][color=#0000bb]count [/color][color=#007700]== [/color][color=#0000bb]0[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"không tìm thấy"[/color][color=#007700]); } }[/color] 
    </blockquote></div>
    </div>
    </div>

  7. #27
    Ngày tham gia
    Mar 2014
    Bài viết
    0
    Trích dẫn Gửi bởi vjrus.ht
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    package demojava[/color][color=#007700].[/color][color=#0000bb]android[/color][color=#007700].[/color][color=#0000bb]vn[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]unit25 [/color][color=#007700]{ private [/color][color=#0000bb]string name[/color][color=#007700][]; private [/color][color=#0000bb]int num[/color][color=#007700]; private [/color][color=#0000bb]string temp[/color][color=#007700]; [/color][color=#0000bb]void input[/color][color=#007700]() { [/color][color=#0000bb]scanner inp [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); try { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"numbers: "[/color][color=#007700]); [/color][color=#0000bb]num [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error: " [/color][color=#007700]+ [/color][color=#0000bb]e[/color][color=#007700].[/color][color=#0000bb]tostring[/color][color=#007700]()); } [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]name [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]num[/color][color=#007700]]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]num[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"student " [/color][color=#007700]+ ([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]) + [/color][color=#dd0000]" name: "[/color][color=#007700]); [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } [/color][color=#0000bb]void sort[/color][color=#007700]() { for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]num [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) for ([/color][color=#0000bb]int j [/color][color=#007700]= ([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]); [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]num[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) if ([/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]compareto[/color][color=#007700]([/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]) > [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]temp [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]; [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]; [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]temp[/color][color=#007700]; } } [/color][color=#0000bb]void show[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"student list"[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]num[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]" " [/color][color=#007700]+ [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } [/color][color=#0000bb]void search[/color][color=#007700]([/color][color=#0000bb]string find[/color][color=#007700]) { [/color][color=#0000bb]find [/color][color=#007700]= [/color][color=#0000bb]find[/color][color=#007700].[/color][color=#0000bb]tolowercase[/color][color=#007700](); [/color][color=#0000bb]boolean check [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]num[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]temp [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]tolowercase[/color][color=#007700](); if ([/color][color=#0000bb]temp[/color][color=#007700].[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]find[/color][color=#007700]) != -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]name[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); [/color][color=#0000bb]check [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; } } if (![/color][color=#0000bb]check[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"keyword not found."[/color][color=#007700]); } public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]unit25 unit25 [/color][color=#007700]= new [/color][color=#0000bb]unit25[/color][color=#007700](); [/color][color=#0000bb]unit25[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]unit25[/color][color=#007700].[/color][color=#0000bb]sort[/color][color=#007700](); [/color][color=#0000bb]unit25[/color][color=#007700].[/color][color=#0000bb]show[/color][color=#007700](); [/color][color=#0000bb]scanner inp [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"key word find: "[/color][color=#007700]); [/color][color=#0000bb]unit25[/color][color=#007700].[/color][color=#0000bb]search[/color][color=#007700]([/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); }}[/color] 
    </blockquote></div>
    </div>
    </div>
    cach viet code cua ban nay hay dang de hoc hoi

  8. #28
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    /*
    * -bai minh cho phep test du lieu nhap vao (so sinh vien) neu la ki tu hoac
    * so sinh vien <=0 se yeu cau nhap lai
    * - sau khi nhap va dua ra danh sach sinh vien chuong trinh yeu cau chon cong viecj muon thuc hien
    * --> 1 sap xep ten sinh vien theo a,b,c
    * --> tim kiem sinh vien theo 2 truong hop ( khong phan biet chu hoa va
    * thuong):
    * --> tim kiem chinh xac
    * --> tim kiem theo tu khoa
    */

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>bai 25 - string (move your mouse to reveal the content)</noscript>

    bai 25 - string (open)
    bai 25 - string (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    package baitapvenha[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]arrays[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#ff8000]/*** tạo 1 mảng các chuỗi là danh sách tên học sinh. nhập vào 1 chuỗi nào đó. sắp* xếp danh sách tên theo thứ tự bảng chữ cái a, b, c..... tìm kiếm tất cả các* tên học sinh giống tuyệt đối hoặc gần giống với từ khóa tìm kiếm đều được* hiện ra. ví dụ nhập từ khóa tìm kiếm: "hoang" thì sẽ hiện ra tất cả các tên* sau (nếu như chúng có trong danh sách): hoang thi yen, nguyen hoang hiep, vu* van hoang, hoang, hoang, hoang van tien, ... (kết quả tìm kiếm không phân* biệt chữ hoa và chữ thường!)*/[/color][color=#007700]public class [/color][color=#0000bb]buoi25_string [/color][color=#007700]{ static [/color][color=#0000bb]scanner sc [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]buoi25_string test [/color][color=#007700]= new [/color][color=#0000bb]buoi25_string[/color][color=#007700](); [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"input the number n = "[/color][color=#007700]); try { [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]integer[/color][color=#007700].[/color][color=#0000bb]parseint[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
    error: " [/color][color=#007700]+ [/color][color=#0000bb]e[/color][color=#007700]); } if ([/color][color=#0000bb]n [/color][color=#007700]<= [/color][color=#0000bb]0[/color][color=#007700]) [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
    the number student have to > 0.
    input again:
    "[/color][color=#007700]); } while ([/color][color=#0000bb]n [/color][color=#007700]<= [/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]string dshocsinh[/color][color=#007700][] = new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]nhap[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]xuat[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700]); [/color][color=#0000bb]int choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); [/color][color=#0000bb]boolean b [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; while([/color][color=#0000bb]b[/color][color=#007700]){ switch ([/color][color=#0000bb]choose[/color][color=#007700]) { case [/color][color=#0000bb]1[/color][color=#007700]: [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]sapxep[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700]); [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); break; case [/color][color=#0000bb]2[/color][color=#007700]: [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]searchtuyetdoi[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700])); [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); break; case [/color][color=#0000bb]3[/color][color=#007700]: [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]search[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]dshocsinh[/color][color=#007700])); [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); break; case [/color][color=#0000bb]4[/color][color=#007700]: [/color][color=#0000bb]b [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"exit application! "[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].exit([/color][color=#0000bb]0[/color][color=#007700]); default: [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"the number \"" [/color][color=#007700]+ [/color][color=#0000bb]choose [/color][color=#007700]+ [/color][color=#dd0000]"\" not valid in system! please try again:"[/color][color=#007700]); [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]choose[/color][color=#007700](); } } } public [/color][color=#0000bb]void nhap[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string a[/color][color=#007700][]) { for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" student " [/color][color=#007700]+ [/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#dd0000]": "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } public [/color][color=#0000bb]void xuat[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string a[/color][color=#007700][]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"array student: "[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"-->" [/color][color=#007700]+ [/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#dd0000]" : " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } public [/color][color=#0000bb]void sapxep[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]a[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
    array student after sort: "[/color][color=#007700]); [/color][color=#0000bb]arrays[/color][color=#007700].[/color][color=#0000bb]sort[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700]); [/color][color=#0000bb]xuat[/color][color=#007700]([/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]a[/color][color=#007700]); } public [/color][color=#0000bb]string searchtuyetdoi[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]a[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"input full name for search : "[/color][color=#007700]); [/color][color=#0000bb]string s [/color][color=#007700]= [/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]string search [/color][color=#007700]= [/color][color=#dd0000]""[/color][color=#007700]; [/color][color=#0000bb]int dem [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]equalsignorecase[/color][color=#007700]([/color][color=#0000bb]s[/color][color=#007700])) { [/color][color=#0000bb]search [/color][color=#007700]+= [/color][color=#dd0000]" " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]+[/color][color=#dd0000]"; "[/color][color=#007700]; [/color][color=#0000bb]dem[/color][color=#007700]++; } } if ([/color][color=#0000bb]dem [/color][color=#007700]!= [/color][color=#0000bb]0[/color][color=#007700]) return [/color][color=#dd0000]"==>have " [/color][color=#007700]+ [/color][color=#0000bb]dem [/color][color=#007700]+ [/color][color=#dd0000]" student with name " [/color][color=#007700]+ [/color][color=#0000bb]s [/color][color=#007700]+ [/color][color=#dd0000]":
    " [/color][color=#007700]+ [/color][color=#0000bb]search[/color][color=#007700]; return [/color][color=#dd0000]"==>no student have name " [/color][color=#007700]+ [/color][color=#0000bb]s[/color][color=#007700]; } public [/color][color=#0000bb]string search[/color][color=#007700]([/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]string a[/color][color=#007700][]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"input the key for search: "[/color][color=#007700]); [/color][color=#0000bb]string s [/color][color=#007700]= ([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()).[/color][color=#0000bb]tolowercase[/color][color=#007700](); [/color][color=#0000bb]string search [/color][color=#007700]= [/color][color=#dd0000]""[/color][color=#007700]; [/color][color=#0000bb]int dem [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]tolowercase[/color][color=#007700]().[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]s[/color][color=#007700]) != -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]search [/color][color=#007700]+= [/color][color=#dd0000]" " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]+[/color][color=#dd0000]"; "[/color][color=#007700]; [/color][color=#0000bb]dem[/color][color=#007700]++; } } if ([/color][color=#0000bb]dem [/color][color=#007700]!= [/color][color=#0000bb]0[/color][color=#007700]) return [/color][color=#dd0000]"==>have " [/color][color=#007700]+ [/color][color=#0000bb]dem [/color][color=#007700]+ [/color][color=#dd0000]" student with key " [/color][color=#007700]+ [/color][color=#0000bb]s [/color][color=#007700]+ [/color][color=#dd0000]":
    " [/color][color=#007700]+ [/color][color=#0000bb]search[/color][color=#007700]; return [/color][color=#dd0000]"==>no student have key " [/color][color=#007700]+ [/color][color=#0000bb]s[/color][color=#007700]; } public [/color][color=#0000bb]void [/color][color=#007700]list() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"

    ==== list function ==== "[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
    1. sort"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
    2. search by name excectly"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
    3. search by key"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
    4. exit"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
    => enter the choose: "[/color][color=#007700]); } public [/color][color=#0000bb]int choose[/color][color=#007700]() { [/color][color=#0000bb]int choose [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; list(); try { [/color][color=#0000bb]choose [/color][color=#007700]= [/color][color=#0000bb]integer[/color][color=#007700].[/color][color=#0000bb]parseint[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); } catch ([/color][color=#0000bb]exception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
    error: " [/color][color=#007700]+ [/color][color=#0000bb]e[/color][color=#007700]); } return [/color][color=#0000bb]choose[/color][color=#007700]; }}[/color] 
    </blockquote></div>
    </div>
    </div>

  9. #29
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]lesson25 [/color][color=#007700]{ private [/color][color=#0000bb]int sohs[/color][color=#007700]; private [/color][color=#0000bb]string trunggian[/color][color=#007700]; private [/color][color=#0000bb]string studentsname[/color][color=#007700][]; private [/color][color=#0000bb]string keyword[/color][color=#007700]; [/color][color=#0000bb]scanner ent1 [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]scanner ent2 [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]scanner ent3[/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]void enter[/color][color=#007700](){ try{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap so hoc sinh : "[/color][color=#007700]); [/color][color=#0000bb]sohs [/color][color=#007700]= [/color][color=#0000bb]ent1[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); }catch([/color][color=#0000bb]exception e1[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]e1[/color][color=#007700].[/color][color=#0000bb]tostring[/color][color=#007700]()); } [/color][color=#0000bb]studentsname [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]sohs[/color][color=#007700]]; for ([/color][color=#0000bb]int dem[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]dem[/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700];[/color][color=#0000bb]dem[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"hoc sinh "[/color][color=#007700]+([/color][color=#0000bb]dem[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700])+[/color][color=#dd0000]": "[/color][color=#007700]); [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]dem[/color][color=#007700]] = [/color][color=#0000bb]ent2[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } [/color][color=#0000bb]void sort[/color][color=#007700](){ for ([/color][color=#0000bb]int i [/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++){ for ([/color][color=#0000bb]int j[/color][color=#007700]=([/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700]);[/color][color=#0000bb]j[/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700];[/color][color=#0000bb]j[/color][color=#007700]++){ if ([/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]compareto[/color][color=#007700]([/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]].[/color][color=#0000bb]trim[/color][color=#007700]())> [/color][color=#0000bb]0[/color][color=#007700]){ [/color][color=#0000bb]trunggian [/color][color=#007700]= [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]; [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]= [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]; [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]= [/color][color=#0000bb]trunggian[/color][color=#007700]; } } } } private [/color][color=#0000bb]void show[/color][color=#007700](){ for ([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700](([/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700])+[/color][color=#dd0000]"."[/color][color=#007700]+[/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]touppercase[/color][color=#007700]()); } } private [/color][color=#0000bb]void timkiem[/color][color=#007700](){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap tu khoa can tim : "[/color][color=#007700]); [/color][color=#0000bb]keyword [/color][color=#007700]= [/color][color=#0000bb]ent3[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ket qua tim kiem :"[/color][color=#007700]); for ([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++){ if (([/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]tolowercase[/color][color=#007700]()).[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]keyword[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]tolowercase[/color][color=#007700]()) != -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } } public static [/color][color=#0000bb]void main [/color][color=#007700]([/color][color=#0000bb]string [/color][color=#007700][][/color][color=#0000bb]args[/color][color=#007700]){ [/color][color=#0000bb]lesson25 a [/color][color=#007700]= new [/color][color=#0000bb]lesson25[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]enter[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]sort[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]show[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]timkiem[/color][color=#007700](); } }[/color] 
    </blockquote></div>
    </div>
    </div>

  10. #30
    Trích dẫn Gửi bởi legendtk84
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]lesson25 [/color][color=#007700]{ private [/color][color=#0000bb]int sohs[/color][color=#007700]; private [/color][color=#0000bb]string trunggian[/color][color=#007700]; private [/color][color=#0000bb]string studentsname[/color][color=#007700][]; private [/color][color=#0000bb]string keyword[/color][color=#007700]; [/color][color=#0000bb]scanner ent1 [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]scanner ent2 [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]scanner ent3[/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]void enter[/color][color=#007700](){ try{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap so hoc sinh : "[/color][color=#007700]); [/color][color=#0000bb]sohs [/color][color=#007700]= [/color][color=#0000bb]ent1[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); }catch([/color][color=#0000bb]exception e1[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]e1[/color][color=#007700].[/color][color=#0000bb]tostring[/color][color=#007700]()); } [/color][color=#0000bb]studentsname [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]sohs[/color][color=#007700]]; for ([/color][color=#0000bb]int dem[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]dem[/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700];[/color][color=#0000bb]dem[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"hoc sinh "[/color][color=#007700]+([/color][color=#0000bb]dem[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700])+[/color][color=#dd0000]": "[/color][color=#007700]); [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]dem[/color][color=#007700]] = [/color][color=#0000bb]ent2[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } } [/color][color=#0000bb]void sort[/color][color=#007700](){ for ([/color][color=#0000bb]int i [/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++){ for ([/color][color=#0000bb]int j[/color][color=#007700]=([/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700]);[/color][color=#0000bb]j[/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700];[/color][color=#0000bb]j[/color][color=#007700]++){ if ([/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]compareto[/color][color=#007700]([/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]].[/color][color=#0000bb]trim[/color][color=#007700]())> [/color][color=#0000bb]0[/color][color=#007700]){ [/color][color=#0000bb]trunggian [/color][color=#007700]= [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]; [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]= [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]; [/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]= [/color][color=#0000bb]trunggian[/color][color=#007700]; } } } } private [/color][color=#0000bb]void show[/color][color=#007700](){ for ([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700](([/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700])+[/color][color=#dd0000]"."[/color][color=#007700]+[/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]touppercase[/color][color=#007700]()); } } private [/color][color=#0000bb]void timkiem[/color][color=#007700](){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap tu khoa can tim : "[/color][color=#007700]); [/color][color=#0000bb]keyword [/color][color=#007700]= [/color][color=#0000bb]ent3[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ket qua tim kiem :"[/color][color=#007700]); for ([/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]sohs[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]++){ if (([/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]tolowercase[/color][color=#007700]()).[/color][color=#0000bb]indexof[/color][color=#007700]([/color][color=#0000bb]keyword[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]tolowercase[/color][color=#007700]()) != -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]studentsname[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } } public static [/color][color=#0000bb]void main [/color][color=#007700]([/color][color=#0000bb]string [/color][color=#007700][][/color][color=#0000bb]args[/color][color=#007700]){ [/color][color=#0000bb]lesson25 a [/color][color=#007700]= new [/color][color=#0000bb]lesson25[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]enter[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]sort[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]show[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]timkiem[/color][color=#007700](); } }[/color] 
    </blockquote></div>
    </div>
    </div>
    hi toppic này khá lâu rồi nên chắc là admin cũng ít khi vào lại xem, mình thấy các ae mới bọn mình đăng bài làm vào thì nên xem bài trên và góp ý những cái mình thấy rồi cùng trao đổi thảo luận thì tốt hơn là cứ đăng bài lên mà cũng k có ai review lại bài của mình, cũng nản

Trang 3 của 4 Đầu tiênĐầu tiên 1234 CuốiCuối

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •