dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersMatt M
sp
Asheej T K
Saranya
shrikanth
pragna
Saravana Perumal
Padma
Ranipriya
Rakesh Chaubey
Sidharthan
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Resources » Code Snippets » Console Applications

How to find realtion b/w 2 persons using their names???


Posted Date:     Category: Console Applications    
Author: Member Level: Bronze    Points: 10


hello all, this is one of its quite intersting program by using a tag word "FLAMES"Where we can find the relation of the 2 persons. just take 2 names "naveen" and "sanjana",while comparing the 2 strings we have to delete the equal characters and the we have switch case where we have to count the characters in the remain string



 



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication11
{
class Program
{

static void Main(string[] args)
{
int a, count = 0;
Console.WriteLine("Enter First String");
string first = Console.ReadLine();
Console.WriteLine("Enter Second string");
string second = Console.ReadLine();

StringBuilder str = new StringBuilder();
foreach (char ch in first)
{
if (second.ToString().IndexOf(ch) < 0)
{
str.Append(ch);
count++;
}
}

foreach (char ch2 in second)
{
if (first.ToString().IndexOf(ch2) < 0)
{
str.Append(ch2);
count++;
}
}

Console.WriteLine(str.ToString());
Console.WriteLine(count);
a= count % 6;
Console.WriteLine(a);
switch (a)
{
case 1: Console.WriteLine("friends");
break;
case 2: Console.WriteLine("lovers");
break;
case 3: Console.WriteLine("affection");
break;

case 4: Console.WriteLine("marriege");
break;

case 5: Console.WriteLine("enemy");
break;

case 6: Console.WriteLine("sisters");
break;

}

Console.ReadLine();
}


}
}





Did you like this resource? Share it with your friends and show your love!


Responses to "How to find realtion b/w 2 persons using their names???"
Guest Author: naveen kumar     30 May 2012
NICE WORK


Author: SivaSaiKrishna    18 Jun 2012Member Level: Silver   Points : 0
Very Nice


Guest Author: pranesh     27 Feb 2013
hi .. in this program if i use the strings first: praneesh, second: devi the character "e" totally get neglected result to "pranshdvi"

as my requirement i would like to neglect the character "e" by its count on each sides so the result comes like this "praneshdvi"

could you please help



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Abstract Classes with new and override keywords
    Previous Resource: Using Tag property of the controls in WindowsFormsApplication.
    Return to Resources
    Post New Resource
    Category: Console Applications


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Console application  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.