Wednesday, September 26, 2012

Structure of C# Code

using System;
class ClassName
{

 Variable declaration

 Method Declaration

 public static void Main(string []args)
 {

  Create class Object
  Alocate Memory to Object
  Call Functions from the Class

 }
}

Tuesday, September 25, 2012

How to solve a program in C#.Net

First identify the Inputs of the program & also identify the requirements.

 WriteLine() is used for Output
 ReadLine() is used for Input
 Write() is used for Output

ReadLine() Function accept String data from the user


System is a namespace,which helps us to input and output data from user using different classes.

Namespace is a combination of similar type of classes

Ram basic salary is input through keyboard. His HRA is 50% of basic salary and DA is 20 % of basic salary. Calculate the gross salary?

Step 1. Input the basic salary.

Step 2. Identify the basic thinks needed for Program

 Class
 Main
 System
 Console
 WriteLine
 ReadLine


Sample Program:
using System;
class RamSalary
{
 public static void Main(string [] args)
 {
  double sal,HRA,DA,Grossal;

  Console.WriteLine("Enter Salary: ");
  sal = Convert.ToDouble(Console.ReadLine());\\10000
  HRA = sal * .5;\\5000
  DA = sal * .2;\\2000
  Grossal = sal+ HRA + DA;\\17000 = 10000 + 5000 + 2000
  Console .WriteLine("Gross Salary is : {0}",Grossal);
\\17000
 }
}

Saturday, September 22, 2012

Calling asp.net page in IFRAME, from code behind file in C#


Step 1: Write the following code in aspx file:


<IFRAME id="frame1" src="http://www.google.com"  runat="server">
         


Step 2: Write the following code in Code Behind file:

 protected void Button1_Click(object sender, EventArgs e)
{
        frame1.Attributes.Add("src", "
http://www.live.com");
}

Formal Dress Code For Men & Women


Thursday, September 20, 2012

Array using C#.Net 2008

using System;
class Program
{
    static void Main(string[] args)
    {

       //Declaration of Array
       int[] score;

       //initialization of Array 
       score = new int[5];
           

       score[0] = 10;
       score[1] = 20;
       score[2] = 5;
       score[3] = 50;
       score[4] = 40;
       // Displaying an Array  
       for (int j = 0; j < 5; j++)
       {
           Console.WriteLine(score[j]);
       }
      

       //For Each Loop
       foreach (int k in score)
       {
           Console.WriteLine(k);
       }
       Console.ReadLine();
    }
}

While Loop & Do While Loop in C#.Net 2008

using System;
class Program
{
    static void Main(string[] args)
    {
       //While LOOP           

       int i;
       i = 0;
       while (i <= 10)
       {
           Console.WriteLine("While Loop");
           i++;
       }
      

       //Do While LOOP
       int j;
       j = 0;
       do
       {
          Console.WriteLine("do While Loop");
          j++;
       } while (j <= 10);
   

       Console.ReadLine();
   }
}

How to write a Simple For Loop in C#.Net 2008

using System;
class Program
{
    static void Main(string[] args)
    {
       for (int i = 0; i <= 10; i++)
       {
           Console.WriteLine("Hello");
       }
       Console.ReadLine();
    }
}

How to write a simple switch case in C#.Net 2008

using System;
class Program
{
  static void Main(string[] args)
  {
    int i;

    i = 0;
    Console.WriteLine("Enter any number: ");
    i = Convert.ToInt32(Console.ReadLine());
    switch (i)
    {
      case 1:
              Console.WriteLine("One");
              break;
      case 2:
              Console.WriteLine("TWO");
              break;
      case 3:
              Console.WriteLine("Three");
              break;
      default:
         Console.WriteLine("invalid Number");
         break;
    }
    Console.ReadLine();
  }
}

How to write Simple Program in C #.Net 2008

using System;
class Program
{
     static void Main(string[] args)
     {
          Console.WriteLine("Hello");
          Console.ReadLine();
     }

}

 

Friday, August 24, 2012

LOOPs

Now that we have started with Loops..

_________________________________
Keywords used in loops

for, while, repeat...until
_________________________________
Examples are :_________________________________
for( int i =1; i<=10;i=i+1)
begin
        display "Hello world"
end
_________________________________
numeric i
i=1
while(i<=10)
begin
       display "Hello World"
       i=i+1
end
_________________________________

Tuesday, August 14, 2012

If Construct....

Solve all the questions we discussed in class.
Use if construct  OR
Use if else Construct OR
Use Nested if Construct.

Syntax of if Construct is

if <condition>
begin

                    Print messages or values if the condition is TRUE

end



Syntax of if...else Construct is

if <condition>
begin

                    Print messages or values if the condition is TRUE

end
else

begin

                    Print messages or values if the condition is FALSE

end

Syntax of Nested IF Construct is

if <condition>
begin
       if <condition>
       begin   
                    Print messages or values if the condition is TRUE
        end
        else
        begin
                    Print messages or values of the condition is FALSE
        end   
end
else

begin

                    Print messages or values if the condition is FALSE

end






Thursday, August 09, 2012

Operators

Write down all the questions using Operators that is (Arithmetic, Relational and Logical Operators).
Arithmetic Operators are:
* / % + -
Relational Operators are:
==,  >,  <,  !=,  >=,  <=.
Logical Operators are:
AND,  OR,  NOT

Solve all the previous exercises.

Best Of Luck.


Tuesday, August 07, 2012

How to recover hidden files and folders


Steps to Recover data from hidden folder, after virus attack.


1. Open command prompt.

2. Change to that drive where folders are hidden, using the following command.

       By Default you will be at :

       C:\Documents and Settings\Administrator> or C:\Documents and Settings\username>

       Type the following command(Suppose your drive is I)

       C:\Documents and Settings\Administrator>I: and press Enter

       You will see I:> 

3. Now type the following command:
   
    I:>Attrib -s -h /s /d *.*

Friday, August 03, 2012

pseudocode for problems

Write down all the Pseudocode for the previous problem which we have discussed in the class?