To follow this step:
1. Download Asp.Net 3.5 framework sp1 and install it.
2. Download AspNetMVC1 then install it.
3. For Nunit test download nunitProjecttemplate file .
To install nunitprojecttemplate file
Follw this step:
3.1 extact and both copy nunie.zip file and nunit.reg file and copy it to following path c:\programfiles/Microsoft Visual studio 9/
common/IDE/projecttemplate/chsarp/test/1033/
3.2 open all programm/visula studio 2008/command promt/then copy devenv/ setup and paste it and click enter
3.3 run nunit.reg file
4.open visual studio 2008 ...file --> New project -->select asp.net MVC framwork-->give project name
Now Open solution explorer and see Model,View,Controller folder in your project.
class calculator
{
int a=0, b;
char option, d='y';
void insert()
{
while (d=='y')
{
option=Convert.ToChar(Console.ReadLine());
switch(option)
{
case '+':
b=Convert.ToInt32(Console.ReadLine());
a=a+b;
Console.WriteLine("Result of Addition : "+a);
break;
case '-':
b=Convert.ToInt32(Console.ReadLine());
a=a-b;
Console.WriteLine("Result of Addition : "+a);
break;
case '*':
b=Convert.ToInt32(Console.ReadLine());
a=a*b;
Console.WriteLine("Result of Addition : "+a);
break;
case '/':
b=Convert.ToInt32(Console.ReadLine());
a=a/b;
Console.WriteLine("Result of Addition : "+a);
break;
default:
Console.WriteLine("invalid value");
d='n';
break;
}
}
}
public static void Main (string[] a)
{
calculator cal=new calculator();
cal.insert();
}
}
class prime
{
int i,c,b;
void insert()
{
Console.WriteLine("Enter your value");
b=Convert.ToInt32(Console.ReadLine());
for(int j=1; j<=b; j++)
{
for(i=2; i
c=j%i;
if(c==0)
{
/*Console.WriteLine("Not prime {0}",j);*/
break;
}
}
if(c!=0)
{
Console.WriteLine("Prime {0}",j);
}
}
}
public static void Main(string[] arg)
{
prime p = new prime();
p.insert();
Console.Read();
}
}
class Addition
{
int H,E,M,sc,sn,so=0;
int sum=0;
float per=0;
public void insert()
{
Console.WriteLine("Enter your Value of Hindi");
H=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter your Value of English");
E=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter your Value of Maths");
M=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter your Value of Science");
sc=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter your Value of Sanskrit");
sn=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter your Value of Social Science");
so=Convert.ToInt32(Console.ReadLine());
}
public void result()
{
sum=H+E+M+sc+sn+so;
per=sum*100/600;
}
public void print()
{
Console.WriteLine("Your Total is: "+sum+" And Your Percentage is: "+per);
}
}
class Implementation
{
public static void Main(string[] arg)
{
Addition obj=new Addition();
obj.insert();
obj.result();
obj.print();
Console.Read();
}
}
Tutorial on How to create my first C# console application in Microsoft Visual Studio
This Tutorial is basically for the begineers of C#. This tutorial is only for C sharp learners. To create a console application program follow the following steps in the serial order.
1.Open Microsoft Visual Studio 2005/2008 from going to start menu then all programs and then search for Microsoft Visual Studio 2005 or 2008 version.It will look like a folder.
2. Go to that folder,ie take your mouse cursor to the position of that folder.
3. It will open a slider menu and you will find a tab with name Microsoft Visual Studio.
4.Click on this link and wait for 5-10 seconds .It will open microsoft visual studio.
5.Then Go to file menu [ press alt+f as a shortcut ] then go to new. then it will open a popup with lot of menu.
6. on the left side on that menu select C# as you are going to learn with C#.
7.Then After clicking on C# on your left side of window,now click on the console application in the right side of your window.
8.You can choose the name and location based on your preference at the bottom of this window.
9.Press OK .It will save your settings and will open the default view of console application.It will open a default code like
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
}
}
}
10. Now,write your code and press CTRL+f5 to run the program
Note: Shortcut for opening Visual Studio directly from Run Command: devenv.exe Type and hit enter to open directly.
Note:
using System;
using System.Collections.Generic;
using System.Text;
The above 3 line are Visual Studio header file like you use #include in C or cplusplus.
Example: Program for Printing Hello World Hello World... This is my first Program in Dot net
using System;
namespace Pankaj
{
class HelloWorld
{
static void Main()
{
Console.WriteLine("Hello World... This is my first Program in Dot net");
Console.WriteLine("Press Any Key to exit: ....");
Console.ReadKey();//this is for reading the key from the users.
}
}
}
/*this program is written in CSharp.
* 1. Main Method is always Static
*
*/
any thing between /* and */ is called as Comment .
Hope this beginner tutorial will help you. For any help on this topin leave your comment.
Thank you.
Pankaj Gupta