Posts

Showing posts from 2010

C Data Types

Data types are used to store various types of data that is processed by program. Data type attaches with variable to determine the number of bytes to be allocate to variable and valid operations which can be performed on that variable. C supports various data types such as character, integer and floating-point types. Character Data Type C stores character type internally as an integer. Each character has 8 bits so we can have 256 different characters values (0-255). Character set is used to map between an integer value and a character. The most common character set is ASCII. Let take a look at example of using a variable which hold character 'A'. #include  void main()  {  char ch = 'A';  printf("%c\n",ch);  ch = 65;                     // using integer representation  printf("%c\n",ch);  ch = '\x41';               // using hexadecimal representation ...

Getting Started with C.

The C program is a set of functions. A C program always starts executing in a special function called main function. Here is the simple but famous "Hello World" program which prints "Hello World" greeting to screen. #include void main() { printf("Hello World!\n"); } The first line is the the #include directive. C program uses this directive to load external function library - stdio is c library which provides standard input/output. printf is a function which is declared in the header file called stdio.h The next is the main function - the first entry point of all C programs. C program logic starts from the beginning of main function to the its ending. And finally is the printf function which accepts a string parameter. The printf function is used to print out the message to the screen.

C Language (Switching Values)

#include #include void main() { int a,b,c; a=10; b=25; printf("\nThe Value of A is %d",a); printf("\nThe Value of B is %d",b); c=a; a=b; b=c; printf("\nNow the Value of A is %d",a); printf("\nNow the Value of B is %d",b) ; getch(); }

C Language (Leap Year)

#include #include void main() { int year; clrscr(); printf("Enter Year "); scanf("%d",&year); if (year%4==0 && year%100!=0) printf("\n This is leap year"); else printf("\n This is not leap year"); getch(); }

C Language (Functions)

#include #include char ucase(); void main() { char ch1; clrscr(); ch1 = ucase(); printf("\n The Character is %c",ch1); getch(); } char ucase() { char ch; ch = getche(); if (ch>=65 && ch =97 && ch ch=ch-32; return(ch); }

C Language (Fibonacci Series)

#include #include void main() {  int a,b,c,e;  printf("Enter End Value ");  scanf("%d",&e);  clrscr();  printf("\n Generate Fibonacci Numbers till %d",e);  a=0;  b=1;  c=a+b; printf("\n \n %d , %d , %d",a,b,c);  while (c  {  a=b;  b=c;  c=a+b;  printf(", %d",c);  }  getch(); }

C Language (Fibonacci Series)

#include #include void main() {  int a,b,c,e;  printf("Enter End Value ");  scanf("%d",&e);  clrscr();  printf("\n Generate Fibonacci Numbers till %d",e);  a=0;  b=1;  c=a+b; printf("\n \n %d , %d , %d",a,b,c);  while (c  {  a=b;  b=c;  c=a+b;  printf(", %d",c);  }  getch(); }

C Language (Character Print)

#include #include void main() {  int a;  char ch;  clrscr();  for (a=65;a<=90;a++)  {  ch = a;  printf("\n %d ",a);  printf("  =    %c",ch); } getch(); }

C Language (Arrays)

#include #include void main() { clrscr(); int a[7]; int b,c=5; for (b=1;b<=5;b++) { a[b] = c; c++; } for (b=0;b<=7;b++) { printf("\n The No. a(%d) is %d",b,a[b]); } getch(); }

C Language (Prime No.)

#include #include void main() {  int n,i,j,c;  clrscr();  printf("Enter Starting Value");  scanf("%d", &i);  printf("Enter Ending Value");  scanf("%d",&n); while (i<=n)  {  c=0;  for (j=1;j<=i;j++)  {   if(i%j==0)   c++;   }   if (c==2)  printf("\n %d    ",i);  i++;  }   getch(); }

C Language (Factorial) While Loop

#include #include void main() {  clrscr();  long a,b;  printf("Enter value");  scanf("%ld",&a);  b=a;  printf("\n %ld",b);  while(a>1)   {  a--;  printf(" * %ld" ,a);  b=b*a;       }   printf(" = %ld",b);   getch(); }

C Language (Factorial) Do while loop

#include #include void main() {  clrscr();  long a,b;  printf("Enter value");  scanf("%ld",&a);  b=a;  printf("\n %ld",b);  do    {  a--;  printf(" * %ld" ,a);  b=b*a;       }   while (a>1);   printf(" = %ld",b);   getch(); }

C Language (Time Table) DO While Loop

#include #include void main() {  clrscr();  int a,c,s;  printf("Enter value");  scanf("%d",&s);  a=1;  do   {   c=s*a;  printf("\n %d", s);  printf(" x ");  printf("%d",a);  printf(" = ");  printf("%d" ,c); a++;   }   while (a<=10);  getch(); }

C Language (LOOP)

#include #include void main() {  clrscr();  int a;  for (a=0;a<=10;a++)  printf("\n The loop is %d", a);  getch(); }

C Language (Time Table) While Loop

#include #include void main() {  clrscr();  int a,c,s;  printf("Enter value");  scanf("%d",&s);  a = 1;  while (a<=10)   {   c=s*a;  printf("\n %d", s);  printf(" x ");  printf("%d",a);  printf(" = ");  printf("%d" ,c);   a++;   }  getch(); }

C Language (Time Table)

#include #include void main() {  clrscr();  int a,c,s;  printf("Enter value");  scanf("%d",&s);  for (a=1;a<=10;a++)   {   c=s*a;  printf("\n %d", s);  printf(" x %d",a);  printf(" = %d" ,c);   }  getch(); }

C Language (Conversion Celcius b/w farheniet)

#include #include void main() {  clrscr();  int a,e,s,o;  printf("For Even Nos type 1 and for ODD Nos type 2");  scanf("%d",&o);  printf("\n Enter starting value");  scanf("%d",&s);  printf("\n Enter End Value");  scanf("%d",&e);  if (o==1)  {  if (s%2!=0)  {  s++;  } }  if (o==2)  { if (s%2==0)  { s++; }}  for (a=s;a<=e;a++,a++)  printf("\n The loop is %d", a);  getch(); }

C Language (Conversion Celcius to Farheniet)

#include #include void main() { float c,f; clrscr(); printf ("Enter Value"); scanf ("%f",&c); f = (c+32)*9/5; printf("The ans is %f",f); getch(); }

C Language (Area of the ROOM)

#include #include void main() { int l,b,p; clrscr(); printf ("Enter Value"); scanf ("%d,%d",&l,&b); p=(2*l)+(2*b); printf("The ans is %d",p); getch(); }

C Language EVEN OR ODD NO.

#include #include void main() { int a; clrscr(); printf ("Enter Value"); scanf ("%d",&a); if (a%2==0) { printf("This is EVEN No."); } else printf("This is ODD No."); getch(); }

C Language Program1

#include #include void main( ) { printf ("This is a line of text to output."); }

Floatable ChildWindow with Enabled background

Image
When we use child Window in Silverlight its Automatically disable Background but its floatable so i want using child window float feature without disabling the background so i childwindow is top element on xmal so alway on top thats you can not access back button or any other control so i put childwindow in popup control and make popup on or off .

Print Gridview, Report Builder

Image
Download Source Code

Silverlight For GPS Navigation

Image
Silverlight 4.0 gives support of COM access. BY the using COM PORT With Help of ActiveXpart  COMTOOLKIT  and  magellan gps explorist 210  and i try make gps navigation application in silverlight with bingmap api. in this application i use  magellan gps explorist 210  or you can use and gps divce with bhi nema format coordinate by the pasing Native coordinate you use lat,long and maped with bingmap or google map apis you can change coordinate with help opensource silverlight ProjNet and make my own tracking system. Download SourceCode

Finding Connecting String

Image
We find a connection string that use in VB 6.0, VB.Net and other languages. 1. Open Notepad. 2. Save blank notepad naming "a.udl" (define any name but use this extension ".udl" 3. Open that file. 4. Click Next 5. Select Access File. 6. Test Connection and Click OK. 7. Right Click on that file and Open in notepad. 8. Copy Connection String and paste in to VB or where you use.

Basic Calculator

Image
Design Form 1. Insert Label ( For Result ) 2. Insert Textbox ( For 1st Value ) 3. Insert Textbox ( For 2nd Value ) 4. Insert 4 Buttons ( +, - , * , / ) In code use label & textbox name. As Shown Below Button Code for + : lblResult.Text = val(txt1.text) + val(txt2.text) Button Code for - : lblResult.Text = val(txt1.text) - val(txt2.text) Button Code for * : lblResult.Text = val(txt1.text) * val(txt2.text) Button Code for / : lblResult.Text = val(txt1.text) / val(txt2.text) As Shown Below. Run Program . . . . .  For Any Problem email me at intelligentprogrammer@gmail.com

Operators

Mathematical and Text operators Operator Definition  Example  Result  ^  Exponent (power of)  5 ^ 2  25  *  Multiply  6 * 5  30  /  Divide  100 / 4  25  +  Add  6 + 4  10  -  Subtract  10 - 5  5  Mod  Remainder of division  25 Mod 7  4  \  Integer division  25 \ 9  2  &  String concatenation  "Usama" & " " & "Hafeez"  "Usama Hafeez"  Note that the order of operators is determined by the usual rules in programming. When a statement includes multiple operations the order of operations is: Parentheses ( ), ^, *, /, \, Mod, +, - Logical operators Operator  Definition  Example  Result  =  Equal to  12 = 15  False  >  Greater than  15 > 11  True  <  Less than  15 < 7  False  >=  Greater or eq...

Control Structures

If...Then...Else If  condition1  Then        statements1 Else      statements2 End If If condition1 is True, then statements1 is executed; Else, condition1 is not True, therefore statements2 gets executed. The structure must be terminated with the End If statement. The Else clause is optional. In a simple comparison, statements1 get executed or not. If  condition1  Then      statements1 End If Select Case Can be used as an alternative to the  If...Then...Else  structure, especially when many comparisons are involved. Select Case  ShirtSize       Case  1           SizeName.Caption = "Small"       Case  2           SizeName.Caption = "Medium"       Case  3           SizeName.Caption = "Large"       Case  4 ...

Data Types

Data type Storage size Range Byte 1 byte 0 to 255 Boolean 2 bytes True or False Integer 2 bytes -32,768 to 32,767 Long (long integer) 4 bytes -2,147,483,648 to 2,147,483,647 Single (single-precision floating-point) 4 bytes -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values Double (double-precision floating-point) 8 bytes -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values Currency (scaled integer) 8 bytes -922,337,203,685,477.5808 to 922,337,203,685,477.5807 Decimal 14 bytes +/-79,228,162,514,264,337,593,543,950,335 with no decimal point; +/-7.9228162514264337593543950335 with 28 places to the right of the decimal; smallest non-zero number is +/-0.00000000...

Variables

Image
Define Variables. Define Variables with Dim, Public Example: Dim a as integer Dim b as integer Public i as integer Here integer is a data type of a variable. Dim is work within the form or procedure. and public is work within the  application. Form1 Form2

Using Procedures

Image
vYou want to perform specific code 2 or more times. to avoid the repeating code, use procedures Example: Make Procedure as shown below.

Form Designing

Image
FORM DESIGNING: - Simply Drag & Drop Tools. Like Textbox, Label, Combobox etc CODE EVENTS:-        Any tool have a code at event. like Button has many events Click Event, key press event, mouse move event etc. for code of default event double click on tool (double click on button, on textbox) EXAMPLE CODE FOR BUTTON CLICK EVENT:- 1. Open Blank Application 2. On Form Draw a Button. 3. Double Click on Button. 4. Write code on given below and  as shown below in pic. Msgbox ("Hello World")

Microsoft Visual Basic.Net

Image
Visual Studio 2008 Every day, software developers solve tough problems to create applications that improve the lives of others.  The Microsoft Visual Studio system is a suite of development tools designed to aid programmers whether they are rookies or seasoned pros face complex problems and create innovative solutions. Visual Studio's role is to improve the development process to make those breakthroughs easier and faster to achieve. Visual Studio 2008 provides advanced development tools, debugging features, database functionality, and innovative features for quickly creating cutting-edge applications across a variety of platforms. VB Versions The .Net environment has undergone several upgrades since it was first introduced in 2002. First there was Visual Studio .Net, then Visual Studio 2005 and now Visual Studio 2008 on the .Net Framework 3.5. If you are coming to VB 2008 from 2005 or .Net you won't see a really big difference. Applications will be converted easily with no...