Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how can i

how can i

Scheduled Pinned Locked Moved C#
regexhelpdatabasequestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Friend4u
    wrote on last edited by
    #1

    These two programs are giving errors while compiling. WAP that counts the no. of occurence of particular character in a line of text. class demo { private int Occurance(string Input, string Find) { System.Text.RegularExpressions.Regex rx = new System.Text.RegularExpressions.Regex(Find); // to display them do this System.Text.RegularExpressions.Match mt = rx.Match(Input); while (mt.Success) { System.Console.WriteLine("Found >>" + Find + "<< at position " + mt.Index.ToString()); mt = mt.NextMatch(); } // end display return rx.Matches(Input).Count; } } This program is giving error that entry point is not defined. ------------------------------- WAP to take 2 dates using objects(day,month,year)& display both dates,their comparison also that which one is greater(take the dates with the help of three parameter constructors) class demo { private DateTime getDate(int day, int month, int year) { return new DateTime(year, month, day); } private void compareDates(DateTime a, DateTime b) { if (a > b) Console.WriteLine(a.ToShortDateString() + " > " + b.ToShortDateString()); else if (a == b) Console.WriteLine(a.ToShortDateString() + " = " + b.ToShortDateString()); else Console.WriteLine(a.ToShortDateString() + " < " + b.ToShortDateString()); } } this program is giving error "type or namespace couldnot be found(are u missing a using directive or an assembly reference).

    E S 2 Replies Last reply
    0
    • F Friend4u

      These two programs are giving errors while compiling. WAP that counts the no. of occurence of particular character in a line of text. class demo { private int Occurance(string Input, string Find) { System.Text.RegularExpressions.Regex rx = new System.Text.RegularExpressions.Regex(Find); // to display them do this System.Text.RegularExpressions.Match mt = rx.Match(Input); while (mt.Success) { System.Console.WriteLine("Found >>" + Find + "<< at position " + mt.Index.ToString()); mt = mt.NextMatch(); } // end display return rx.Matches(Input).Count; } } This program is giving error that entry point is not defined. ------------------------------- WAP to take 2 dates using objects(day,month,year)& display both dates,their comparison also that which one is greater(take the dates with the help of three parameter constructors) class demo { private DateTime getDate(int day, int month, int year) { return new DateTime(year, month, day); } private void compareDates(DateTime a, DateTime b) { if (a > b) Console.WriteLine(a.ToShortDateString() + " > " + b.ToShortDateString()); else if (a == b) Console.WriteLine(a.ToShortDateString() + " = " + b.ToShortDateString()); else Console.WriteLine(a.ToShortDateString() + " < " + b.ToShortDateString()); } } this program is giving error "type or namespace couldnot be found(are u missing a using directive or an assembly reference).

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      1. You haven't defined an entry point. Where's your Main()? 2. Are you creating a dll? BTW: Make your title more descriptive in the future.

      1 Reply Last reply
      0
      • F Friend4u

        These two programs are giving errors while compiling. WAP that counts the no. of occurence of particular character in a line of text. class demo { private int Occurance(string Input, string Find) { System.Text.RegularExpressions.Regex rx = new System.Text.RegularExpressions.Regex(Find); // to display them do this System.Text.RegularExpressions.Match mt = rx.Match(Input); while (mt.Success) { System.Console.WriteLine("Found >>" + Find + "<< at position " + mt.Index.ToString()); mt = mt.NextMatch(); } // end display return rx.Matches(Input).Count; } } This program is giving error that entry point is not defined. ------------------------------- WAP to take 2 dates using objects(day,month,year)& display both dates,their comparison also that which one is greater(take the dates with the help of three parameter constructors) class demo { private DateTime getDate(int day, int month, int year) { return new DateTime(year, month, day); } private void compareDates(DateTime a, DateTime b) { if (a > b) Console.WriteLine(a.ToShortDateString() + " > " + b.ToShortDateString()); else if (a == b) Console.WriteLine(a.ToShortDateString() + " = " + b.ToShortDateString()); else Console.WriteLine(a.ToShortDateString() + " < " + b.ToShortDateString()); } } this program is giving error "type or namespace couldnot be found(are u missing a using directive or an assembly reference).

        S Offline
        S Offline
        shopi30
        wrote on last edited by
        #3

        Remember that the sintax is: using System; //All namespace to attach namespace demo {     public class demo     {         public demo()         {             //this is the constructor but if the app is console application you need de main method         }         public Main()         {             this.demo();         }         private int Occurance(string Input, string Find)         {             System.Text.RegularExpressions.Regex rx = new System.Text.RegularExpressions.Regex(Find); // to display them do this             System.Text.RegularExpressions.Match mt = rx.Match(Input);             while (mt.Success)             {                 System.Console.WriteLine("Found >>" + Find + "<< at position " + mt.Index.ToString());                 mt = mt.NextMatch();             }             // end display             return rx.Matches(Input).Count;         }         private DateTime getDate(int day, int month, int year)         {             return new DateTime(year, month, day);         }         private void compareDates(DateTime a, DateTime b)         {          &nbs

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups