1
Reply

getting not proper result anyone help? in tenses conversion

Muhammad Muzamil

Muhammad Muzamil

Jan 10 2015 9:18 PM
976
using System; using System.Collections.Generic; using System.Linq; using System.Text;   namespace CrApp {     class Program     {         public static int count = 0;         public static string[] verb_presentc = new string[] { " reading "" eating ""  playing ""  studing ""  walking ""  riding ""  driving ""was""reads" };         public static string[] verb_past = new string[] { " read "" ate "" played "" studied "" walked "" ride "" drove " };         public static string past(int count, string[] text)         {             for (int i = 0; i <= 7; i++)             {                 if (i == count)                     text[1] = verb_past[i];               }             return text[1];         }           public static string present(string s)         {               if (s == "eats")             { return ("eating"); }             else if (s == "plays" || s == "playing")             { return ("playing"); }             else if (s == "studies")             { return ("studying"); }             else if (s == "walks")             { return ("walking"); }             else if (s == "rides")             { return ("riding"); }             else if (s == "drives")             { return ("driving"); }             else if (s == "reads" || s == "reading" || s == "read")             { return (" reading"); }             else if (s == "was")             { return ("is"); }             else if (s == "was")             { return (" "); }             return "None";         }         public static string pst(string sh)         {             if (sh == "reading")             {                 return ("was reading");             }             return "none";           }         public static string pastp(string ss)         {             if (ss == "eats" || ss == "eat" || ss == "is eating" || ss == "am eating" || ss == "are eating" ||                  ss == "was eating" || ss == "were eating")             {                 return ("eaten");             }             else if (ss == "reads" || ss == "read" || ss == "reading" || ss == "am reading" || ss == "are reading" ||                 ss == "was reading" || ss == "were reading")             {                 return ("read");             }             else if (ss == "rides" || ss == "ride" || ss == "is riding" || ss == "am riding" || ss == "are riding" ||                  ss == "was riding" || ss == "were riding")             {                 return ("riden");             }             else if (ss == "drive" || ss == "drives" || ss == "is driving" || ss == "am driving" || ss == "are driving" ||                 ss == "was driving" || ss == "were driving")             {                 return ("driven");             }             else if (ss == "plays" || ss == "play" || ss == "is playing" || ss == "am playing" || ss == "are playing" ||                  ss == "was playing" || ss == "were playing")             {                 return ("played");             }             return " none";         }         public static string pasts(string ab)         {             if (ab == "reading")             {                 return ("reads");             }             else if (ab == "was")             { return (""); }             else if (ab == "playing")             { return ("played"); }             return "none";         }         public static string spresent(string b)         {             if (b == "was reading")             {                 return ("reads");             }             //if (b == "reading")             //{             //    return ("reads");             //}             return "None";         }         public static string remove(string r)         {             if (r == "is")             {                 return (" ");             }             return "none";         }         //public static string continuous(int count, string[] text)         //{         //    for (int i = 0; i <= 7; i++)         //    {         //        if (i == count)         //            text[2] = verb_presentc[i];           //    }         //    return text[2];           //}           static void Main(string[] args)         {                          //string[] a = new string[3];             //a[0] = Console.ReadLine();             //a[1] = Console.ReadLine();             //a[2] = Console.ReadLine();             string[] sentences = new string[] { "eats""plays""studies""walks""rides""drives""reads""reading""playing", };             //string[] sentences2 = new string[] { "read" };             Console.Write("Enter the sentence : ");             string temp = Console.ReadLine();             string[] text = temp.Split();             for (int i = 0; i <= (text.Length - 1); i++)             {                 for (int j = 0; j <= (sentences.Length - 1); j++)                 {                       if (text[i] == sentences[j])                         //if (sentences[i] == temp)                     {                         int count = i;                           Console.WriteLine("Correct Sentence");                           Console.WriteLine("What do you want to do?");                         Console.WriteLine("1.Convert to Present tense: ");                         Console.WriteLine(" \t a.Convert to simple Present: ");                         Console.WriteLine(" \t b.Convert to Present continuous: ");                         Console.WriteLine(" \t c.Convert to Present perfect: ");                         Console.WriteLine(" \t d.Convert to Present perfect continuous: ");                         Console.WriteLine("2.Convert to Past tense: ");                         Console.WriteLine(" \t a.Convert to simple past: ");                         Console.WriteLine(" \t b.Convert to past continuous: ");                         Console.WriteLine(" \t c.Convert to past perfect: ");                         Console.WriteLine(" \t d.Convert to past perfect continuous: ");                         Console.WriteLine("3.Convert to Future tense: ");                         Console.WriteLine(" \t a.Convert to simple future: ");                         Console.WriteLine(" \t b.Convert to future continuous: ");                         Console.WriteLine(" \t c.Convert to future perfect: ");                           ////////////////////conversion/////////////////////////                         Console.WriteLine("ENTER OPTION");                         int choice = Convert.ToInt32(Console.ReadLine());                         switch (choice)                         {                             case 1:                                 {                                     Console.WriteLine("ENTER YOUR CHOICE");                                     char option = Convert.ToChar(Console.ReadLine());                                     if (option == 'a')                                     {                                       }                                       if (option == 'b')                                     {                                         string p = Convert.ToString(present(text[count]));                                         text[count] = " is " + p;                                         //for (int j = 0; j <= verb_presentc.Length; j++)                                         //{                                         //    if (j == count)                                         //        text[1] = verb_presentc[j];                                         //}                                       }                                     else                                         if (option == 'c')                                         {                                             string p = Convert.ToString(pastp(text[count]));                                             text[count] = " has " + p;                                                                                        }                                         else                                             if (option == 'd')                                             {                                                 string p = Convert.ToString(present(text[count]));                                                 text[count] = "\b\b\b\b has been" + p;                                             }                                     break;                                 }                             case 2:                                 {                                       Console.WriteLine("ENTER YOUR CHOICE");                                     char option = Convert.ToChar(Console.ReadLine());                                     if (option == 'a')                                     {                                         string p = Convert.ToString(pastp(text[count]));                                         text[count] = p;                                       }                                     else                                         if (option == 'b')                                         {                                             string p2 = Convert.ToString(pst(text[count]));                                             string p = Convert.ToString(remove(text[count]));                                             text[count] = p + "  " +p2 ;                                                                                      }                                         else                                             if (option == 'c')                                             {                                                 string pc = Convert.ToString(pastp(text[count]));                                                 text[count] = " had " + pc;                                             }                                             else                                                 if (option == 'd')                                                 {                                                     string pc = Convert.ToString(present(text[count]));                                                     text[count] = " had been " + pc;                                                 }                                     break;                                 }                             case 3:                                 {                                     Console.WriteLine("ENTER YOUR CHOICE");                                     char option = Convert.ToChar(Console.ReadLine());                                     if (option == 'a')                                     {                                         //string p = Convert.ToString(present(count, text));                                         text[count] = " will " + sentences[j];                                     }                                     else                                         if (option == 'b')                                         {                                              string fc = Convert.ToString(present(text[count]));                                               text[count] = " will be " + fc;                                         }                                         else                                             if (option == 'c')                                             {                                                   string p = Convert.ToString(pastp(text[count]));                                                 text[1] = " will have " + p;                                             }                                     break;                                   }                           }                           foreach (string w in text)                         {                             Console.Write(w + " ");                         }                         Console.WriteLine();                           break;                     }                     }                 }         }         }     } 

Answers (1)