Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #61479 > unrolled thread

Test This code tell me the correct one

Started byjobs.amit02@gmail.com
First post2015-05-03 23:42 -0700
Last post2015-05-04 13:38 +0200
Articles 6 — 6 participants

Back to article view | Back to comp.lang.c


Contents

  Test This code tell me the correct one jobs.amit02@gmail.com - 2015-05-03 23:42 -0700
    Re: Test This code tell me the correct one August Karlstrom <fusionfile@gmail.com> - 2015-05-04 08:50 +0200
      Re: Test This code tell me the correct one Ian Collins <ian-news@hotmail.com> - 2015-05-04 19:39 +1200
      Re: Test This code tell me the correct one Philip Lantz <prl@canterey.us> - 2015-05-04 00:52 -0700
        Re: Test This code tell me the correct one gazelle@shell.xmission.com (Kenny McCormack) - 2015-05-04 11:27 +0000
          Re: Test This code tell me the correct one Noob <root@127.0.0.1> - 2015-05-04 13:38 +0200

#61479 — Test This code tell me the correct one

Fromjobs.amit02@gmail.com
Date2015-05-03 23:42 -0700
SubjectTest This code tell me the correct one
Message-ID<a5cc68f3-cda1-44c4-9c71-3218bfb6a16d@googlegroups.com>
using System;
using System.Collections.Generic;

public class Member
{
    public string Email { get; private set; }

    public ICollection<Member> Friends { get; private set; }

    public Member(string email) : this(email, new List<Member>())
    {
    }

    public Member(string email, ICollection<Member> friends)
    {
        this.Email = email;
        this.Friends = friends;
    }

    public void AddFriends(ICollection<Member> friends)
    {
        foreach (Member friend in friends)
            this.Friends.Add(friend);
    }

    public void AddFriend(Member friend)
    {
        this.Friends.Add(friend);
    }
}

public class Friends
{
    public static List<Member> GetFriendsOfDegree(Member member, int degree)
    {
        throw new NotImplementedException("Waiting to be implemented.");
    }

    public static void Main(string[] args)
    {
        Member a = new Member("A");
        Member b = new Member("B");
        Member c = new Member("C");

        a.AddFriend(b);
        b.AddFriend(c);

        foreach (Member friend in GetFriendsOfDegree(a, 2))
            Console.WriteLine(friend.Email);
    }
}
[02/05/15 9:18:28 pm] @mit Agnihotri: Given a data structure representing a social network, write a function that finds friends of a certain degree. Friends of the first degree are a member's immediate friends, friends of the second degree are friends of a member's friends excluding first degree friends, etc.

For example, if A is a friend with B and B is a friend with C, then GetFriendsOfDegree(A, 2) should return C since C is the only second degree friend of A (B is a first degree friend of A).

[toc] | [next] | [standalone]


#61480

FromAugust Karlstrom <fusionfile@gmail.com>
Date2015-05-04 08:50 +0200
Message-ID<mi74s9$71f$1@speranza.aioe.org>
In reply to#61479
On 2015-05-04 08:42, jobs.amit02@gmail.com wrote:
> using System;
[...]

Try comp.lang.c++

-- August

[toc] | [prev] | [next] | [standalone]


#61483

FromIan Collins <ian-news@hotmail.com>
Date2015-05-04 19:39 +1200
Message-ID<cqom0nFm5ldU2@mid.individual.net>
In reply to#61480
August Karlstrom wrote:
> On 2015-05-04 08:42, jobs.amit02@gmail.com wrote:
>> using System;
> [...]
>
> Try comp.lang.c++

Why? The code isn't C++....

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#61487

FromPhilip Lantz <prl@canterey.us>
Date2015-05-04 00:52 -0700
Message-ID<MPG.2fb0c50be33bd4661c@news.eternal-september.org>
In reply to#61480
August Karlstrom wrote:
> 
> On 2015-05-04 08:42, jobs.amit02@gmail.com wrote:
> > using System;
> [...]
> 
> Try comp.lang.c++
> 
> -- August

Nope, they wouldn't like that code over there either.

[toc] | [prev] | [next] | [standalone]


#61493

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2015-05-04 11:27 +0000
Message-ID<mi7l2q$9td$3@news.xmission.com>
In reply to#61487
In article <MPG.2fb0c50be33bd4661c@news.eternal-september.org>,
Philip Lantz  <prl@canterey.us> wrote:
>August Karlstrom wrote:
>> 
>> On 2015-05-04 08:42, jobs.amit02@gmail.com wrote:
>> > using System;
>> [...]
>> 
>> Try comp.lang.c++
>> 
>> -- August
>
>Nope, they wouldn't like that code over there either.

Just out of curiosity, what *is* it?

I don't know much about any of the C*** languages (I just use plain old C),
but my first assumption on seeing something like "using <whatever>" is that
it is C#.  Is that the the case here?

-- 
Atheism:
    It's like being the only sober person in the car, and nobody will let you drive.

[toc] | [prev] | [next] | [standalone]


#61494

FromNoob <root@127.0.0.1>
Date2015-05-04 13:38 +0200
Message-ID<mi7lkr$5rg$1@dont-email.me>
In reply to#61493
Kenny McCormack wrote:

> Just out of curiosity, what *is* it?
> 
> I don't know much about any of the C*** languages (I just use plain old C),
> but my first assumption on seeing something like "using <whatever>" is that
> it is C#.  Is that the the case here?

Plopping "using System.Collections.Generic" in a search engine
returns C# and MSDN links. So C# is a good bet.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web