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


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();
}


}
}


Comments

Guest Author: naveen kumar30 May 2012

NICE WORK

Author: SivaSaiKrishna18 Jun 2012 Member Level: Silver   Points : 0

Very Nice

Guest Author: pranesh27 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



  • 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:
    Email: