Array

main

#import <Foundation/Foundation.h>
#import "cricketers.h"


int main(int argc, const char * argv[]) {
    //India
    Cricketers * dhoni = [[Cricketers alloc]init];
    dhoni.firstName=@"Mahendra";
    dhoni.lastName=@"Singh Dhoni";
    dhoni.country=@"India";
    
    Cricketers * sachin = [[Cricketers alloc]init];
    sachin.firstName=@"Sachin";
    sachin.lastName=@"Ramesh Tendulkar";
    sachin.country=@"India";
    
    Cricketers * yuvraj = [[Cricketers alloc]init];
    yuvraj.firstName=@"Yuvraj";
    yuvraj.lastName=@"Singh";
    yuvraj.country=@"India";
    
    Cricketers * rayudu = [[Cricketers alloc]init];
    rayudu.firstName=@"Ambati";
    rayudu.lastName=@"Rayudu";
    rayudu.country=@"India";
    
    Cricketers * kohli = [[Cricketers alloc]init];
    kohli.firstName=@"Virat";
    kohli.lastName=@"Kohli";
    kohli.country=@"India";
    
    NSMutableArray * india = [[NSMutableArray alloc]initWithObjects:dhoni,sachin,yuvraj,rayudu,kohli, nil];
    
//    NSLog(@"India Cricket Team");
//    for (int i=0; i<india.count; i++) {
//        Cricketers * indianPlayerDetails = [india objectAtIndex:i];
//        NSLog(@"Indian Player Index %i Details First Name=%@  Last Name=%@ Country=%@",i,indianPlayerDetails.firstName,indianPlayerDetails.lastName,indianPlayerDetails.country);
//    }
    
    // sriLanka
    
    Cricketers * sangakkara = [[Cricketers alloc]init];
    sangakkara.firstName=@"Kumar";
    sangakkara.lastName=@"Sangakkara";
    sangakkara.country=@"SriLanka";
    
    Cricketers * mathews = [[Cricketers alloc]init];
    mathews.firstName=@"Angelo";
    mathews.lastName=@"Mathews";
    mathews.country=@"SriLanka";
    
    Cricketers * malinga = [[Cricketers alloc]init];
    malinga.firstName=@"Lasith";
    malinga.lastName=@"Malinga";
    malinga.country=@"SriLanka";
    
    Cricketers * perera = [[Cricketers alloc]init];
    perera.firstName=@"Kusal";
    perera.lastName=@"Perera";
    perera.country=@"SriLanka";
    
    Cricketers * dilshan= [[Cricketers alloc]init];
    dilshan.firstName=@"Thillakaratna";
    dilshan.lastName=@"Dilshan";
    dilshan.country=@"SriLanka";
    
    NSMutableArray * srilanka = [[NSMutableArray alloc]initWithObjects:sangakkara,mathews,malinga,perera,dilshan, nil];
    
//    NSLog(@"SriLanka Cricket Team");
//    for (int i=0; i<srilanka.count; i++) {
//        Cricketers * sriLankaPlayerDetails = [srilanka objectAtIndex:i];
//        NSLog(@"Indian Player Index %i Details First Name=%@  Last Name=%@ Country=%@",i,sriLankaPlayerDetails.firstName,sriLankaPlayerDetails.lastName,sriLankaPlayerDetails.country);
//    }
    
    //Pakistan
    
    Cricketers * afridi = [[Cricketers alloc]init];
    afridi.firstName=@"Shahid";
    afridi.lastName=@"Afridi";
    afridi.country=@"Pakistan";
    
    Cricketers * amir = [[Cricketers alloc]init];
    amir.firstName=@"Mohammed";
    amir.lastName=@"Amir";
    amir.country=@"Pakistan";
    
    Cricketers * akmal = [[Cricketers alloc]init];
    akmal.firstName=@"Umar";
    akmal.lastName=@"Akmal";
    akmal.country=@"Pakistan";
    
    Cricketers * hafeez = [[Cricketers alloc]init];
    hafeez.firstName=@"Mohammed";
    hafeez.lastName=@"Hafeez";
    hafeez.country=@"Pakistan";
    
    Cricketers * malik = [[Cricketers alloc]init];
    malik.firstName=@"Shoaib";
    malik.lastName=@"Malik";
    malik.country=@"Pakistan";
    
    NSMutableArray * pakistan = [[NSMutableArray alloc]initWithObjects:afridi,amir,akmal,hafeez,malik, nil];
    
//    NSLog(@"pakistan Cricket Team");
//    for (int i=0; i<pakistan.count; i++) {
//        Cricketers * pakistanPlayerDetails = [pakistan objectAtIndex:i];
//        NSLog(@"pakistan Player Index %i Details First Name=%@  Last Name=%@ Country=%@",i,pakistanPlayerDetails.firstName,pakistanPlayerDetails.lastName,pakistanPlayerDetails.country);
//    }
    
    //Bangladesh
    
    Cricketers * iqbal = [[Cricketers alloc]init];
    iqbal.firstName=@"Tamim";
    iqbal.lastName=@"Iqbal";
    iqbal.country=@"Bangladesh";
    
    Cricketers * ahmed = [[Cricketers alloc]init];
    ahmed.firstName=@"Taskin";
    ahmed.lastName=@"Ahmed";
    ahmed.country=@"Bangladesh";
    
    Cricketers *  rahman = [[Cricketers alloc]init];
    rahman.firstName=@"Sabbir";
    rahman.lastName=@"Rahman";
    rahman.country=@"Bangladesh";
    
    Cricketers *  rahim = [[Cricketers alloc]init];
    rahim.firstName=@"Mushfiqur";
    rahim.lastName=@"Rahim";
    rahim.country=@"Bangladesh";
    
    Cricketers *  hossain = [[Cricketers alloc]init];
    hossain.firstName=@"Nasir";
    hossain.lastName=@"Hossain";
    hossain.country=@"Bangladesh";

    
    NSMutableArray * bangladesh = [[NSMutableArray alloc]initWithObjects:iqbal,ahmed,rahman,rahim,hossain, nil];
    
//    NSLog(@"bangladesh Cricket Team");
//    for (int i=0; i<bangladesh.count; i++) {
//        Cricketers * bangladeshPlayerDetails = [bangladesh objectAtIndex:i];
//        NSLog(@"bangladesh Player Index %i Details First Name=%@  Last Name=%@ Country=%@",i,bangladeshPlayerDetails.firstName,bangladeshPlayerDetails.lastName,bangladeshPlayerDetails.country);
//    }
    
    // SouthAfrica
    
    Cricketers *  amla = [[Cricketers alloc]init];
    amla.firstName=@"Hashim";
    amla.lastName=@"Amla";
    amla.country=@"SouthAfrica";
    
    Cricketers *  steyn = [[Cricketers alloc]init];
    steyn.firstName=@"Dale";
    steyn.lastName=@"Steyn";
    steyn.country=@"SouthAfrica";
    
    Cricketers *   tahir = [[Cricketers alloc]init];
    tahir.firstName=@"Imran";
    tahir.lastName=@"Tahir";
    tahir.country=@"SouthAfrica";
    
    Cricketers *   miller = [[Cricketers alloc]init];
    miller.firstName=@"David";
    miller.lastName=@"Miller";
    miller.country=@"SouthAfrica";
    
    Cricketers *   morkel = [[Cricketers alloc]init];
    morkel.firstName=@"Morné";
    morkel.lastName=@"Morkel";
    morkel.country=@"SouthAfrica";
    
    
    NSMutableArray * southAfrica = [[NSMutableArray alloc]initWithObjects:amla,steyn,tahir,miller,morkel, nil];
    
//    NSLog(@"SouthAfrica Cricket Team");
//    for (int i=0; i<southAfrica.count; i++) {
//        Cricketers * southAfricaPlayerDetails = [bangladesh objectAtIndex:i];
//        NSLog(@"SouthAfrica Player Index %i Details First Name=%@  Last Name=%@ Country=%@",i,southAfricaPlayerDetails.firstName,southAfricaPlayerDetails.lastName,southAfricaPlayerDetails.country);
//    }
    
    // WestIndians
    
    Cricketers * gayle = [[Cricketers alloc]init];
    gayle.firstName=@"Chris";
    gayle.lastName=@"Gayle";
    gayle.country=@"WestIndians";
    
    Cricketers * bravo = [[Cricketers alloc]init];
    bravo.firstName=@"Dwayne";
    bravo.lastName=@"Bravo";
    bravo.country=@"WestIndians";
    
    Cricketers * sammy = [[Cricketers alloc]init];
    sammy.firstName=@"Darren";
    sammy.lastName=@"Sammy";
    sammy.country=@"WestIndians";
    
    Cricketers *  samuels = [[Cricketers alloc]init];
    samuels.firstName=@"Marlon";
    samuels.lastName=@"Samuels";
    samuels.country=@"WestIndians";
    
    Cricketers *  russell = [[Cricketers alloc]init];
    russell.firstName=@"Andre";
    russell.lastName=@"Russell";
    russell.country=@"WestIndians";
    
    
    NSMutableArray * westIndians = [[NSMutableArray alloc]initWithObjects:gayle,bravo,sammy,samuels,russell, nil];
    
//    NSLog(@"WestIndians Cricket Team");
//    for (int i=0; i<westIndians.count; i++) {
//        Cricketers * westIndiansPlayerDetails = [bangladesh objectAtIndex:i];
//        NSLog(@"WestIndians Player Index %i Details First Name=%@  Last Name=%@ Country=%@",i,westIndiansPlayerDetails.firstName,westIndiansPlayerDetails.lastName,westIndiansPlayerDetails.country);
//    }

    // Zimbabwe
    
    Cricketers * masakadza = [[Cricketers alloc]init];
    masakadza.firstName=@"Hamilton";
    masakadza.lastName=@"Masakadza";
    masakadza.country=@"Zimbabwe";
    
    Cricketers * raza = [[Cricketers alloc]init];
    raza.firstName=@"Sikandar";
    raza.lastName=@"Raza";
    raza.country=@"Zimbabwe";
    
    Cricketers * taylor = [[Cricketers alloc]init];
    taylor.firstName=@"Brendan";
    taylor.lastName=@"Taylor";
    taylor.country=@"Zimbabwe";
    
    Cricketers * williams = [[Cricketers alloc]init];
    williams.firstName=@"Sean";
    williams.lastName=@"Williams";
    williams.country=@"Zimbabwe";
    
    
    Cricketers * cremer = [[Cricketers alloc]init];
    cremer.firstName=@"Graeme";
    cremer.lastName=@"Cremer";
    cremer.country=@"Zimbabwe";
    
    
    NSMutableArray * zimbabwe = [[NSMutableArray alloc]initWithObjects:masakadza,raza,taylor,williams,cremer, nil];
    
//    NSLog(@"Zimbabwe Cricket Team");
//    for (int i=0; i<zimbabwe.count; i++) {
//        Cricketers * zimbabwePlayerDetails = [bangladesh objectAtIndex:i];
//        NSLog(@"Zimbabwe Player Index %i Details First Name=%@  Last Name=%@ Country=%@",i,zimbabwePlayerDetails.firstName,zimbabwePlayerDetails.lastName,zimbabwePlayerDetails.country);
//    }

    // Kenya
    
    Cricketers *  patel = [[Cricketers alloc]init];
    patel.firstName=@"Rakep";
    patel.lastName=@"Patel";
    patel.country=@"Kenya";
    
    Cricketers *  mishra = [[Cricketers alloc]init];
    mishra.firstName=@"Tanmay";
    mishra.lastName=@"Mishra";
    mishra.country=@"Kenya";
    
    Cricketers *  karim = [[Cricketers alloc]init];
    karim.firstName=@"Irfan";
    karim.lastName=@"Karim";
    karim.country=@"Kenya";
    
    Cricketers *  obanda = [[Cricketers alloc]init];
    obanda.firstName=@"Alex";
    obanda.lastName=@"Obanda";
    obanda.country=@"Kenya";
    
    Cricketers *  odoyo = [[Cricketers alloc]init];
    odoyo.firstName=@"Thomas";
    odoyo.lastName=@"Odoyo";
    odoyo.country=@"Kenya";
    
    
    NSMutableArray * kenya = [[NSMutableArray alloc]initWithObjects:patel,mishra,karim,obanda,odoyo, nil];
    
//    NSLog(@"Kenya Cricket Team");
//    for (int i=0; i<kenya.count; i++) {
//        Cricketers * kenyaPlayerDetails = [bangladesh objectAtIndex:i];
//        NSLog(@"Kenya Player Index %i Details First Name=%@  Last Name=%@ Country=%@",i,kenyaPlayerDetails.firstName,kenyaPlayerDetails.lastName,kenyaPlayerDetails.country);
//    }
    
    //NetherLands
    
    Cricketers * borren = [[Cricketers alloc]init];
    borren.firstName=@"Peter";
    borren.lastName=@"Borren";
    borren.country=@"NetherLands";
    
    Cricketers * myburgh = [[Cricketers alloc]init];
    myburgh.firstName=@"Stephan";
    myburgh.lastName=@"Myburgh";
    myburgh.country=@"NetherLands";
    
    Cricketers * cooper = [[Cricketers alloc]init];
    cooper.firstName=@"Tom";
    cooper.lastName=@"Cooper";
    cooper.country=@"NetherLands";
    
    Cricketers * doeschate = [[Cricketers alloc]init];
    doeschate.firstName=@"Ryan ten";
    doeschate.lastName=@"Doeschate";
    doeschate.country=@"NetherLands";
    
    Cricketers * swart = [[Cricketers alloc]init];
    swart.firstName=@"Michael";
    swart.lastName=@"Swart";
    swart.country=@"NetherLands";
    
    
    NSMutableArray * netherLands = [[NSMutableArray alloc]initWithObjects:borren,myburgh,cooper,doeschate,swart, nil];
    
    //Ireland
    
    Cricketers * porterfield = [[Cricketers alloc]init];
    porterfield.firstName=@"William";
    porterfield.lastName=@"Porterfield";
    porterfield.country=@"Ireland";
    
    Cricketers * stirling = [[Cricketers alloc]init];
    stirling.firstName=@"Paul";
    stirling.lastName=@"Stirling";
    stirling.country=@"Ireland";
    
    Cricketers * mooney = [[Cricketers alloc]init];
    mooney.firstName=@"John";
    mooney.lastName=@"Mooney";
    mooney.country=@"Ireland";
    
    Cricketers * joyce = [[Cricketers alloc]init];
    joyce.firstName=@"Ed";
    joyce.lastName=@"Joyce";
    joyce.country=@"Ireland";
    
    Cricketers * wilson = [[Cricketers alloc]init];
    wilson.firstName=@"Gary";
    wilson.lastName=@"Wilson";
    wilson.country=@"Ireland";
    
    
    NSMutableArray * ireland = [[NSMutableArray alloc]initWithObjects:porterfield,stirling,mooney,joyce,wilson, nil];
    
    //England
    
    Cricketers * morgan = [[Cricketers alloc]init];
    morgan.firstName=@"Eoin";
    morgan.lastName=@"Morgan";
    morgan.country=@"England";
    
    Cricketers * buttler = [[Cricketers alloc]init];
    buttler.firstName=@"Jos";
    buttler.lastName=@"Buttler";
    buttler.country=@"England";
    
    Cricketers * ali = [[Cricketers alloc]init];
    ali.firstName=@"Moeen";
    ali.lastName=@"Ali";
    ali.country=@"England";
    
    Cricketers * anderson = [[Cricketers alloc]init];
    anderson.firstName=@"James";
    anderson.lastName=@"Anderson";
    anderson.country=@"England";
    
    Cricketers * bopara = [[Cricketers alloc]init];
    bopara.firstName=@"Ravi";
    bopara.lastName=@"Bopara";
    bopara.country=@"England";
    
    
    NSMutableArray * england = [[NSMutableArray alloc]initWithObjects:morgan,buttler,ali,anderson,bopara, nil];
    
    //ScotLand
    
    Cricketers * mommsen = [[Cricketers alloc]init];
    mommsen.firstName=@"Preston";
    mommsen.lastName=@"Mommsen";
    mommsen.country=@"ScotLand";
    
    Cricketers * coetzer = [[Cricketers alloc]init];
    coetzer.firstName=@"Kyle";
    coetzer.lastName=@"Coetzer";
    coetzer.country=@"ScotLand";
    
    Cricketers * berrington = [[Cricketers alloc]init];
    berrington.firstName=@"Richie";
    berrington.lastName=@"Berrington";
    berrington.country=@"ScotLand";
    
    Cricketers * cross = [[Cricketers alloc]init];
    cross.firstName=@"Matthew";
    cross.lastName=@"Cross";
    cross.country=@"ScotLand";
    
    Cricketers * evans = [[Cricketers alloc]init];
    evans.firstName=@"Alasdair";
    evans.lastName=@"Evans";
    evans.country=@"ScotLand";
    
    
    NSMutableArray * scotLand = [[NSMutableArray alloc]initWithObjects:mommsen,coetzer,berrington,cross,evans, nil];
    
    //Australia
    
    Cricketers * clarke = [[Cricketers alloc]init];
    clarke.firstName=@"Michael";
    clarke.lastName=@"Clarke";
    clarke.country=@"Australia";
    
    Cricketers * bailey = [[Cricketers alloc]init];
    bailey.firstName=@"George";
    bailey.lastName=@"Bailey";
    bailey.country=@"Australia";
    
    Cricketers * faulkner = [[Cricketers alloc]init];
    faulkner.firstName=@"James";
    faulkner.lastName=@"Faulkner";
    faulkner.country=@"Australia";
    
    Cricketers * finch = [[Cricketers alloc]init];
    finch.firstName=@"Aaron";
    finch.lastName=@"Finch";
    finch.country=@"Australia";
    
    Cricketers * haddin = [[Cricketers alloc]init];
    haddin.firstName=@"Brad";
    haddin.lastName=@"Haddin";
    haddin.country=@"Australia";
    
    
    NSMutableArray * australia = [[NSMutableArray alloc]initWithObjects:clarke,bailey,faulkner,finch,haddin, nil];
    
    //Afghanistan
    
    Cricketers * nabi = [[Cricketers alloc]init];
    nabi.firstName=@"Mohammad";
    nabi.lastName=@"Nabi";
    nabi.country=@"Afghanistan";
    
    Cricketers *  zazai = [[Cricketers alloc]init];
    zazai.firstName=@"Afsar";
    zazai.lastName=@"Zazai";
    zazai.country=@"Afghanistan";
    
    Cricketers *  alam = [[Cricketers alloc]init];
    alam.firstName=@"Aftab";
    alam.lastName=@"Alam";
    alam.country=@"Afghanistan";
    
    Cricketers *  hassan = [[Cricketers alloc]init];
    hassan.firstName=@"Hamid";
    hassan.lastName=@"Hassan";
    hassan.country=@"Afghanistan";
    
    Cricketers *  naib = [[Cricketers alloc]init];
    naib.firstName=@"Gulbadin";
    naib.lastName=@"Naib";
    naib.country=@"Afghanistan";
    
    
    NSMutableArray * afghanistan = [[NSMutableArray alloc]initWithObjects:nabi,zazai,alam,hassan,naib, nil];
    
    //New Zealand
    
    Cricketers *  mcCullum = [[Cricketers alloc]init];
    mcCullum.firstName=@"Brendon";
    mcCullum.lastName=@"McCullum";
    mcCullum.country=@"New Zealand ";
    
    Cricketers *  boult = [[Cricketers alloc]init];
    boult.firstName=@"Trent";
    boult.lastName=@"Boult";
    boult.country=@"New Zealand ";
    
    Cricketers *  henry = [[Cricketers alloc]init];
    henry.firstName=@"Matt";
    henry.lastName=@"Henry";
    henry.country=@"New Zealand ";
    
    Cricketers *  guptill = [[Cricketers alloc]init];
    guptill.firstName=@"Martin";
    guptill.lastName=@"Guptill";
    guptill.country=@"New Zealand ";
    
    Cricketers *  latham = [[Cricketers alloc]init];
    latham.firstName=@"Tom";
    latham.lastName=@"Latham";
    latham.country=@"New Zealand ";
    
    
    NSMutableArray * newZealand  = [[NSMutableArray alloc]initWithObjects:mcCullum,boult,henry,guptill,latham, nil];
    
    //UAE
    
    Cricketers *  tauqir = [[Cricketers alloc]init];
    tauqir.firstName=@"Mohammad";
    tauqir.lastName=@"Tauqir";
    tauqir.country=@"UAE";
    
    Cricketers *  javed = [[Cricketers alloc]init];
    javed.firstName=@"Amjad";
    javed.lastName=@"Javed";
    javed.country=@"UAE";
    
    Cricketers *  berenger = [[Cricketers alloc]init];
    berenger.firstName=@"Andri";
    berenger.lastName=@"Berenger";
    berenger.country=@"UAE";
    
    Cricketers *  khan = [[Cricketers alloc]init];
    khan.firstName=@"Khurram";
    khan.lastName=@"Khan";
    khan.country=@"UAE";
    
    Cricketers *  chandran = [[Cricketers alloc]init];
    chandran.firstName=@"Krishna";
    chandran.lastName=@"Chandran";
    chandran.country=@"UAE";
    
    NSMutableArray * UAE = [[NSMutableArray alloc]initWithObjects:tauqir,javed,berenger,khan,chandran, nil];

    //*********** Continents ********
    
    NSMutableArray *asia = [[NSMutableArray alloc]initWithObjects:india,pakistan,srilanka,bangladesh,nil];
//        for (int j=0; j<asia.count; j++)
//        {
//        NSMutableArray * details =[asia objectAtIndex:j];
//        for (int k=0; k<details.count; k++)
//        {
//            Cricketers *playerDetails=[details objectAtIndex:k];
//            NSLog(@"First Name=%@ , Last Name=%@ , Country=%@",playerDetails.firstName,playerDetails.lastName,playerDetails.country);
//        }
//        
//    }
    
    NSMutableArray * africa = [[NSMutableArray alloc]initWithObjects:southAfrica,westIndians,zimbabwe,kenya, nil];
//    for (int j=0; j<africa.count; j++)
//    {
//        NSMutableArray * africaDetails = [africa objectAtIndex:j];
//        for (int k=0; k<africaDetails.count; k++)
//        {
//            Cricketers * africaPlayerDetails = [africaDetails objectAtIndex:k];
//            NSLog(@"First Name=%@ , LastName= %@, Country=%@",africaPlayerDetails.firstName,africaPlayerDetails.lastName,africaPlayerDetails.country);
//        }
//    }
    
    NSMutableArray * europe = [[NSMutableArray alloc]initWithObjects:scotLand,england,netherLands,ireland, nil];
    
    NSMutableArray * otherTeams = [[NSMutableArray alloc]initWithObjects:newZealand,australia,afghanistan,UAE, nil];
    
    
    
    
    
    NSMutableArray * world = [[NSMutableArray alloc]initWithObjects:asia,africa,europe,otherTeams, nil];
    for (int i=0; i<world.count; i++) {
        NSMutableArray * continent = [world objectAtIndex:i];
        for (int j=0; j<continent.count; j++) {
            NSLog(@"********------------*********");
            NSMutableArray * continentDetails = [continent objectAtIndex:j];
            for (int k=0; k<continentDetails.count; k++) {
                Cricketers * worldDetails = [continentDetails objectAtIndex:k];
                NSLog(@" FirstName        LastName            Country");
                NSLog(@"%@                   %@                 %@",worldDetails.firstName,worldDetails.lastName,worldDetails.country);
            }
        }
    }   
    return 0;

}

Cricketer.h

#import <Foundation/Foundation.h>

@interface Cricketers : NSObject
@property NSString * firstName;
@property NSString * lastName;
@property NSString * country;
//@property NSString * indiaPlayerDetails;
//@property NSString * srilankaPlayerDetails;
//@property NSString * pakistanPlayerDetails;
//@property NSString * bangladeshPlayerDetails;

@end

Cricketer.m

#import "Cricketers.h"

@implementation Cricketers

@end
Previous
Next Post »