Archive for July, 2008

The .NET Framework …

The Microsoft .NET Framework is at the heart of the .NET startegy. This framework manages and execute applications and Web services, contains a class libaray( called the .NET Framework Class Library, or FCL ) , enforces security and provides many other programming capabilites.

The Common Language Runtime (CLR) is another central part of the .NET Framework –it executes .NET programs. Programs are compiled into machine-specific instructions in two steps. First, the program is compiled in to Microsoft Intermediate Language (MSIL) , wich defines instructions for the CLR. Code converted into MSIL from other languages and sources can be woven together by the CLR. The MSIL for an application’s components is placed into the application’s executable file ( known as an assembly ). When the application executes, another compiler ( known as the just-in-time compiler or JIT compiler )  in the CLR translates the MSIL in the executable file into machine-language code, then the machine-laguage code executes on the platform.

Note. MSIL is Microsoft’s name for what the C# language specification refers to as Common Intermediate Language (CIL)

Visual C# 2005 How To Program , Deitel

Categories: DOT NET


C# , developed at Microsoft by a team lead by Anders Hejlsberg and Scoot Wiltamuth, was designed specifically for the .NET platform as a langauge that would enable programmers to mirgrate easily to .NET.
It has roots in C, C++ and Java, adapting the best features of each and adding new features of its own. C# is object oriented and contains a powerful  class library of prebuilt components , enabling programmers to develop application quickly . C# is appropriate for demanding application development tasks, especially for building today’s popular Web-based applications.

The  .NET platform is one over which Web-based applications can be distributed to a greate variety of devices and to desktop computers.  The .NET platform enables language interoperability: Software components from different languages can interact as never before. Developers can package even old software to work with new C# programs. Also, C# applications can interact via the XML-based Simple Obect Access Protocol (SOAP)

Visual C# 2005 How To program, Deitel.

Categories: DOT NET

Print Filled diamon or un Filled Diamon


using namespace std;

void pFilledDimon(int size);
void pUnFilledDimon(int size);

void pWhiteSpace(int num); // print the white space , by amount of num
void pStar(int num); // print the * , by amount of num
void pSW(int num);

int main(int argc, char *argv[])
int choice;
cout << "Enter the number for Filled Dimon or UnFilled Dimon (1 or 2) : " ; cin >> choice ;
cout << endl; if (choice == 1) { pFilledDimon(25); } else { pUnFilledDimon(25); } cout << endl; cout << "Thank you for using me ! " << endl; system("PAUSE"); return EXIT_SUCCESS; } void pFilledDimon(int size) { int middle = size / 2; int j = middle; for (int i=0; i 1)
whitenum = num – 2;
cout << "*"; pWhiteSpace(whitenum); pWhiteSpace(whitenum+1); cout << "*"; } } [/sourcecode] This is just another exercise. using fuction and algorithm to print the dimon shap with "*" , and display filled and unfilled dimon indentify by user.

Categories: C++

Simple sort


using namespace std;
const int Max = 5;
void dcOrder(int []);
void acOrder(int []);
void swap(int *, int *);
int main(int argc, char *argv[])
int iarray[Max] ;
cout << " Enter five numbers " << endl ; for (int i = 0; i < Max ; i++) { cout <> “;
cin >> iarray[i] ;

cout << endl; cout << "The new Order according to the sorting function is " << endl; for(int i = 0; i < Max ; i++) { cout < " << iarray[i] << endl; } //system("PAUSE"); //return EXIT_SUCCESS; return 0; } void dcOrder(int iarray []) { for ( int i = 0; i < Max ; i++) { int tempnum = iarray[i]; int j = i ; while (j tempnum) { swap(&iarray[j],&tempnum); } j++; } iarray[i]=tempnum; } } void acOrder(int iarray []) { for ( int i = 0; i < Max ; i++) { int tempnum = iarray[i]; int j = i ; while (j < Max) { if (iarray[j] < tempnum) { swap(&iarray[j],&tempnum); } j++; } iarray[i]=tempnum; } } void swap(int *n1, int *n2) { int tempnum; tempnum = *n1; *n1 = *n2; *n2 = tempnum; } [/sourcecode] We learn many thing in this exercise. First we learn how to work with function. we learn how to pass parameters to the function , pass by reference. Function dcOrder and acOrder are the function that to do the sorting in descending and accending order . They accept an array parameter. when we call this function we pass the name of array to the function and what happend the fucntion will effect to the input parameter . that mean the value of array will change according to the function. The same way in the swap(int *, int *) function. i us the pointer technique to make the value swap between the two input parameters. or you can use the same technique but different manner , by using swap(int & , int & ) instead. and it will look like this void swap(int &num1, int &num2) { int temp; temp = num1; num1 = num2; num2 = temp; } to call this function just pass the variable name ... it sound better , isn't it.? in additional , Passing arrays to functions , the name of array variable is actually the address of the first element of the array[0] , The parameter of the called function, some_list , can be declared in any of the following ways: functionName(int some_list []) // with no subscript { .... } OR functionName(int some_list[10]) // same size as the array you want to pass to function {..... } OR functionName(int *some_list) // int type pointer {.....} Since the address of the array is always passed to a function , it is easy to alter the contents of the array directly in the function. Therefore, arrays do not have to be returned from function explicitly the return statement.

Categories: C++

swap function using pointer

#include <iostream.h>

void swap(int * , int *);

using namespace std;

int main(int argc, char *argv[])
    int n1 , n2 ;
    cout << " n1 = " ;
    cin >> n1 ;
    cout << endl << " n2 = ";
    cin >> n2;
    cout << endl;
    cout << "After swap " << endl << " n1 = " << n1 << endl<< " n2 = " << n2 << endl;

    return EXIT_SUCCESS;

void swap(int *num1, int *num2)
     int temp = 0;
     temp = *num1;
     *num1 = *num2;
     *num2 = temp;
Categories: C++