Skip to main content

Posts

Showing posts from March 7, 2012

enum example in C++.

  #include <iostream.h> int main() { enum Days{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday}; Days TheDay; int j; cout<<" Enter the day of the week (0 to 6) "; cin>>j; TheDay = Days(j); if (TheDay == Sunday || TheDay == Saturday) cout<<" Hurray it is the weekend "<<endl; else cout<<" Still at work "<<endl; return 0; }

To Calculate Determinant of a Matrix Using Recursion in C++.

#include<iostream.h> #include<conio.h> #include<math.h> #include<process.h> void main() { int determinant( int [5][5], int ); // FUNCTIONS void read( int [5][5], int ); void print( int [5][5], int ); // PROTOYPES int a[5][5],l,n; int result; l1:clrscr(); cout<<" ENTER ORDER OF MATRIX(MAX. OF 4X4): "; cin>>l>>n; //TESTING CONDITION if (l!=n) { cout<<" SORRY!!!!!\nONLY SQUARE MATRIX "; goto l1; } read(a,n); result = determinant(a,n); print(a,n); cout<<" THE DETERMINANT OF THE ABOVE MATRIX IS: "<<result; getch(); } void read( int b[5][5], int m) //FUNCTION FOR READING MATRIX { cout<<" ENTER "<<m*m<<" ELEMENTS OF MATRIX(ROW-WISE): "; for ( int i=0;i<m;i++) for ( int j=0;j<m;j++) cin>>b[i][j]; } //FUNCTION FOR PRINTING MATRIX void print( int b[5][5], int m) { clrscr(); cout<<&quo

Draw Lines in java

In this example we are going to draw  Lines. the Lines can be drawn with draw Lines(). In this we are using Graphics class and Applet class. void draw Line( int start x, int start y, int end x, int end y ); This method is used to draw Line Here draw Line(); use to create Line. int start x, int start y denote the starting point of line same as int end x, int end y denote the finishing point of line. Here first we are importing two packages. Then after we have write applet tag into comments. In this tag we have pass three arguments code ,height  and width. The code attribute is used to call the applet class. And Height , width is used for Sizing the window. Then we have create a class and extends this class with Applet Class to accurse the property of applet. We had override paint method of applet class. Then we pass the value of starting point int start x, int start y(0,0) and then pass the value of end point int end x, int end y(100,100).   import java.awt.*; import java.applet.*;

Caching Demo in ASP.NET

  Create a page cachingdemo.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="cachingdemo.aspx.cs" Inherits="cachingdemo" %> <%@ OutputCache Duration="60" VaryByParam="None" %> < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > < html xmlns = "http://www.w3.org/1999/xhtml" > < head runat = "server" > < title > Caching Demo </ title > </ head > < body > < form id = "form1" runat = "server" > < div > < h2 style = "color:Red" > Output Caching </ h2 > < asp : Label ID = "Label1" runat = "server" Font - Size = "Large" ForeColor = "SeaGreen" Text = &qu