Saturday, February 7, 2015

How to draw a circle using HTML and CSS

<html>
<style  type="text/css">
#circle{
width:100px;
height:100px;
mardin:100px auto;
background-color:red;
border-radius:100px;
}
</style>

<body>
<div id="circle"></div>
</body>
</html>

Tuesday, February 3, 2015

Monday, February 2, 2015

Augmented Matrix Solution By reducing it to Row Echelon Form in Java

Read Also:  


Augmented Matrix Solution By reducing it to Row Echelon Form And then Calculate the result by backward substitution (Code in Java) 



package echolon;
import java.util.Scanner;
/**
 *
 * @author usman
 */
public class Echolon {
     Scanner usman=new Scanner(System.in);
    int i,j,k,n,a;
    float [][] A=new float[20][20];
    float  sum;
    float c;
    float [] x=new float[10];
    
    public  Echolon(){
    sum=0;
    System.out.println("\nEnter the order of matrix: ");
    n=usman.nextInt();
    a=n;
    System.out.println("\nEnter the elements of augmented matrix row-wise:\n\n");
    for(i=1; i<=n; i++)
    {
for(j=1; j<=(n+1); j++)

            if(a<j){System.out.println("\nEnter the Value of B: (1st row):- \n ");}
   System.out.println("A["+i+"]["+j+"] : ");
            
   A[i][j]=usman.nextFloat();
}
    }
    }

    void operation() {
    for(j=1; j<=n; j++)
    {
for(i=1; i<=n; i++)
{
   if(i>j)
   {
c=A[i][j]/A[j][j];
for(k=1; k<=n+1; k++)
{
   A[i][k]=A[i][k]-c*A[j][k];
}
   }
}
    }

    x[n]=A[n][n+1]/A[n][n];
     for(i=n-1; i>=1; i--)
    {
sum=0;
for(j=i+1; j<=n; j++)
{
   sum=sum+A[i][j]*x[j];
}
x[i]=(A[i][n+1]-sum)/A[i][i];
    }
    }

    void result(){
    System.out.println("\nThe solution is: \n");
    for(i=1; i<=n; i++)
    {
System.out.println("\nx"+i+" =  "+x[i]+"\t");
    }
    }

void display()
{
System.out.println("\n The Matrix is :-\n ");
for(int i=1;i<=n;i++){
System.out.println("\n");
for(int j=1;j<=n+1;j++){
System.out.println(A[i][j]+"     ");
}}
}


public static void main(String args[]){
Echolon obj=new Echolon();
obj.operation();
obj.display();
obj.result();
}
}



Augmented Matrix Solution By reducing it to Row Echelon Form in C++

Read Also:  


Augmented Matrix Solution By reducing it to Row Echelon Form And then Calculate the result by backward substitution  (Code In C++)....


#include<iostream.h>
#include<conio.h>
class row{
    int i,j,k,n,a;
    float A[20][20],c,x[10],sum;
    public:
    row(){

    sum=0.0;
    cout<<"\nEnter the order of matrix: ";
    cin>>n;
    a=n;
    cout<<"\nEnter the elements of augmented matrix row-wise:\n\n";
    for(i=1; i<=n; i++)
    {
for(j=1; j<=(n+1); j++)
{
  if(a<j){cout<<"\nEnter the Value of B: (1st row):- \n ";}
   cout<<"A["<<i<<"]["<<j<<"] : ";
   cin>>A[i][j];
}
    }
    }

    void operation() {
    for(j=1; j<=n; j++)
    {
for(i=1; i<=n; i++)
{
   if(i>j)
   {
c=A[i][j]/A[j][j];
for(k=1; k<=n+1; k++)
{
   A[i][k]=A[i][k]-c*A[j][k];
}
   }
}
    }

    x[n]=A[n][n+1]/A[n][n];
     for(i=n-1; i>=1; i--)
    {
sum=0;
for(j=i+1; j<=n; j++)
{
   sum=sum+A[i][j]*x[j];
}
x[i]=(A[i][n+1]-sum)/A[i][i];
    }
    }

    void result(){
    cout<<"\nThe solution is: \n";
    for(i=1; i<=n; i++)
    {
cout<<"\nx"<<i<<" =  "<<x[i]<<"\t";
    }
    }

void display()
{
cout<<"\n The Matrix is :-\n ";
for(int i=1;i<=n;i++){
cout<<endl;
for(int j=1;j<=n+1;j++){
cout<<A[i][j]<<"     ";
}}
}

};

void main()
{
clrscr();
row obj;
obj.operation();
obj.display();
obj.result();
getch();

}


Sunday, February 1, 2015

GPA Calculator in JAVA


package usman1;
import java.util.Scanner;
public class Usman1 {
public static void main (String args[]){

  String grade = "";
  double credit1;
  double credit2;
  double credit3;
  double credit4;
  double gradeValue=0;
  double totPtsClass1=0;
  double totPtsClass2=0;
  double totPtsClass3=0;
  double totPtsClass4=0;
  double totPts=0;
  double totalCredits= 0;
  double gpa;

  Scanner console = new Scanner (System.in);
  System.out.println("Please enter the number of credits of the class 1 (A number)");
  credit1 = console.nextDouble();
  System.out.println("Please enter your grades for the class 1(Capital letters such as A,B+, C-)");
  grade = console.next();

  if (grade.equals ("A"))
    gradeValue= 4.00;
  else if (grade.equals("A-"))
    gradeValue= 3.67;
  else if (grade.equals("B+"))
    gradeValue = 3.33;
  else if (grade.equals("B"))
    gradeValue = 3.00;
  else if (grade.equals ("B-"))
    gradeValue = 2.67;
  else if (grade.equals("C+"))
    gradeValue = 2.33;
  else if (grade.equals("C"))
    gradeValue = 2.00;
  else if (grade.equals ("D+"))
  gradeValue = 1.33;
  else if (grade.equals ("D"))
    gradeValue = 1.00;
  else if (grade.equals ("F"))
    gradeValue = 0;
  else if (grade.equals ("FX"))
    gradeValue = 0;
  else
    System.out.println ("Invalid Grade");

  totPtsClass1 = gradeValue * credit1;

  System.out.println("Please enter the number of credits of the class 2 (A number)");
  credit2 = console.nextDouble();
  System.out.println("Please enter your grades for the class 2 (Capital letters such as A,B+, C-)");
  grade = console.next();

  if (grade.equals ("A"))
    gradeValue= 4.00;
  else if (grade.equals("A-"))
    gradeValue= 3.67;
  else if (grade.equals("B+"))
    gradeValue = 3.33;
  else if (grade.equals("B"))
    gradeValue = 3.00;
  else if (grade.equals ("B-"))
    gradeValue = 2.67;
  else if (grade.equals("C+"))
    gradeValue = 2.33;
  else if (grade.equals("C"))
    gradeValue = 2.00;
  else if (grade.equals ("D+"))
  gradeValue = 1.33;
  else if (grade.equals ("D"))
    gradeValue = 1.00;
  else if (grade.equals ("F"))
    gradeValue = 0;
  else if (grade.equals ("FX"))
    gradeValue = 0;
  else
  System.out.println ("Invalid Grade");

  totPtsClass2 = gradeValue * credit2;

  System.out.println("Please enter the number of credits of the class 3 (A number)");
  credit3 = console.nextDouble();
  System.out.println("Please enter your grades for the class 3 (Capital letters such as A,B+, C-)");
  grade = console.next();

  if (grade.equals ("A"))
    gradeValue= 4.00;
  else if (grade.equals("A-"))
    gradeValue= 3.67;
  else if (grade.equals("B+"))
    gradeValue = 3.33;
  else if (grade.equals("B"))
    gradeValue = 3.00;
  else if (grade.equals ("B-"))
    gradeValue = 2.67;
  else if (grade.equals("C+"))
    gradeValue = 2.33;
  else if (grade.equals("C"))
    gradeValue = 2.00;
  else if (grade.equals ("D+"))
  gradeValue = 1.33;
  else if (grade.equals ("D"))
    gradeValue = 1.00;
  else if (grade.equals ("F"))
    gradeValue = 0;
  else if (grade.equals ("FX"))
    gradeValue = 0;
  else
    System.out.println ("Invalid Grade");

    totPtsClass3 = gradeValue * credit3;

  System.out.println("Please enter the number of credits of the class 4 (A number)");
  credit4 = console.nextDouble();
  System.out.println("Please enter your grades for the class 4 (Capital letters such as A,B+, C-)");
  grade = console.next();

  if (grade.equals ("A"))
    gradeValue= 4.00;
  else if (grade.equals("A-"))
    gradeValue= 3.67;
  else if (grade.equals("B+"))
    gradeValue = 3.33;
  else if (grade.equals("B"))
    gradeValue = 3.00;
  else if (grade.equals ("B-"))
    gradeValue = 2.67;
  else if (grade.equals("C+"))
    gradeValue = 2.33;
  else if (grade.equals("C"))
    gradeValue = 2.00;
  else if (grade.equals ("D+"))
  gradeValue = 1.33;
  else if (grade.equals ("D"))
    gradeValue = 1.00;
  else if (grade.equals ("F"))
    gradeValue = 0;
  else if (grade.equals ("FX"))
    gradeValue = 0;
  else
    System.out.println ("Invalid Grade");
  totPtsClass4 = gradeValue * credit4;

  totPts= totPtsClass1+totPtsClass2+totPtsClass3+totPtsClass4;
  totalCredits = credit1+credit2+credit3+credit4;
  gpa= totPts / totalCredits;

  System.out.printf("Your GPA is: %.2f\n", + gpa);
}
}


Transpose Of A Matrix in C++

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[10][10];
int b[10][10];
int row=0,col=0,i,j;
cout<<"\n Enter No of Rows And Colomn: ";
cin>>row>>col;
cout<<"\n Enter the values in matrix: (row by row) ";
for(i=1;i<=row;i++){
for(j=1;j<=col;j++){
cin>>a[i][j];
}}
for(i=1;i<=row;i++){
cout<<endl;
for(j=1;j<=col;j++){
cout<<a[i][j]<<"  \t";
}
}
for(i=1;i<=col;i++){
for(j=1;j<=row;j++){
b[j][i]=a[i][j];
} }
cout<<endl;
cout<<"\n Transpose Of The Matrix You Enter:-\n";
for(i=1;i<=row;i++){
cout<<endl;
for(int j=1;j<=col;j++){
cout<<b[i][j]<<"  \t";
}
}
getch();
      }

Another Screen Short of Code in C.



Monday, January 26, 2015

Scientific Calculator in C++

Read Also:  



Scientific Calculator in C++ Programming SeekerzZ




#include<iostream.h>
#include<math.h>
#include<conio.h>
int main ()
{
clrscr();
float a,b,PI;
int c;
cout<<endl;
cout<<"******************************* Calculator *************************************\n";
cout<<"================================================================================\n";
cout<<"Operations\t"<<"\tTrigonometric Functions"<<"\t\tLogarithmic Functions\n";
cout<<"================================================================================\n";
cout<<"1: Division\t\t"<<"7: Sin\t\t"<<"\t\t13: Log"<<endl;
cout<<endl;
cout<<"2: Multiplication\t"<<"8: Cos\t\t"<<"\t\t14: Log with base 10"<<endl;
cout<<endl;
cout<<"3: Subtraction\t\t"<<"9: Tan\t\t"<<endl;
cout<<endl;
cout<<"4: Addition\t\t"<<"10: Inverse of Sin"<<endl;
cout<<endl;
cout<<"5: Exponent\t\t"<<"11: Inverse of Cos"<<endl;
cout<<endl;
cout<<"6: Square root\t\t"<<"12: Inverse of Tan"<<endl;
cout<<endl;
cout<<"Enter the function that you want to perform : ";
cin>>c;
cout<<endl;
PI=3.14159265;
switch(c)
{
case 1:
cout<<"Enter 1st number : ";
cin>>a;
cout<<endl;
cout<<"Enter 2nd number : ";
cin>>b;
cout<<endl;
cout<<"Division = "<<a/b<<endl;
break;
case 2:
cout<<"Enter 1st number : ";
cin>>a;
cout<<endl;
cout<<"Enter 2nd number : ";
cin>>b;
cout<<endl;
cout<<"Multiplication = "<<a*b<<endl;
break;
case 3:
cout<<"Enter 1st number : ";
cin>>a;
cout<<endl;
cout<<"Enter 2nd number : ";
cin>>b;
cout<<endl;
cout<<"Subtraction = "<<a-b<<endl;
break;
case 4:
cout<<"Enter 1st number : ";
cin>>a;
cout<<endl;
cout<<"Enter 2nd number : ";
cin>>b;
cout<<endl;
cout<<"Addition = "<<a+b<<endl;
break;
case 5:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Enter the exponent : ";
cin>>b;
cout<<endl;
cout<<"Exponent = "<<pow(a,b)<<endl;
break;
case 6:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Square Root = "<<sqrt(a)<<endl;
break;
case 7:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Sin = "<<sin(a)<<endl;
break;
case 8:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Cos = "<<cos(a)<<endl;
break;
case 9:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Tan = "<<tan(a)<<endl;
break;
case 10:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Inverse of Sin = "<<asin(a)*180.0/PI<<endl;
break;

case 11:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Inverse of Cos = "<<acos(a)*180.0/PI<<endl;
break;
case 12:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Inverse of tan = "<<atan(a)*180.0/PI<<endl;
break;
case 13:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Log = "<<log(a)<<endl;
break;
case 14:
cout<<"Enter the number : ";
cin>>a;
cout<<endl;
cout<<"Log with base 10 = "<<log10(a)<<endl;
break;
default:
cout<<"Wrong Input"<<endl;
}
 getch();
 return 0;

}

Thursday, January 22, 2015

Program to evaluate an expression entered in post-fix form in C++

#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <conio.h>
const int MAX = 50 ;
class postfix
{
int stack[MAX] ;
int top, nn ;
char *s ;
public :
postfix( ) ;
void setexpr ( char *str ) ;
void push ( int item ) ;
int pop( ) ;
void calculate( ) ;
void show( ) ;
} ;
postfix :: postfix( )
{
top = -1 ;
}
void postfix :: setexpr ( char *str )
{
s = str ;
}
void postfix :: push ( int item )
{
if ( top == MAX - 1 )
cout << endl << "Stack is full" ;
else
{
top++ ;
stack[top] = item ;
}
}
int postfix :: pop( )
{
if ( top == -1 )
{
cout << endl << "Stack is empty" ;
return NULL ;
}
int data = stack[top] ;
top-- ;
return data ;
}
void postfix :: calculate( )
{
int n1, n2, n3 ;
while ( *s )
{
if ( *s == ' ' || *s == '\t' )
{
s++ ;
continue ;
}
if ( isdigit ( *s ) )
{
nn = *s - '0' ;
push ( nn ) ;
}
else
{
n1 = pop( ) ;
n2 = pop( ) ;
switch ( *s )
{
case '+' :
n3 = n2 + n1 ;
break ;
case '-' :
n3 = n2 - n1 ;
break ;
case '/' :
n3 = n2 / n1 ;
break ;
case '*' :
n3 = n2 * n1 ;
break ;
case '%' :
n3 = n2 % n1 ;
break ;
case '$' :
n3 = pow ( n2 , n1 ) ;
break ;
default :
cout << "Unknown operator" ;
exit ( 1 ) ;
}

push ( n3 ) ;
}
s++ ;
}
}
void postfix :: show( )
{
nn = pop ( ) ;
cout << "Result is: " << nn ;
}

void main( )
{
clrscr();
char expr[MAX] ;
cout << "\nEnter postfix expression to be evaluated : " ;
cin.getline ( expr, MAX ) ;
postfix q ;
q.setexpr ( expr ) ;
q.calculate( ) ;
q.show( ) ;
getch();
}


HUNT Code in C++ :: Create Hunt using C++

 #include<stdio.h>
#include<conio.h>


int main()
{
int i,j,k,l,m=10,n=4;
int o,x,y,z=1,w=0;
int ln=0;
for(i=0;i<10;i++)
{
for(j=0;j<m;j++)

printf(" ");
}
for(k=0;k<12;k++)
{
printf("*");
printf(" ");


for(o=0;o<z;o++)
{
printf(" ");
}
z=z+2;
for(l=0;l<2;l++)
{
printf("*");
printf(" ");
}
n=n++;
m=m--;
printf("\n"); 
}

for(i=0;i<10;i++)

for(k=0;k<2;k++)
{
printf(" ");
}
printf("*");
if(ln<3)
{
for(l=0,x=0;l<17;l++,x++)
printf(" ");
}
else
for(l=0,x=0;l<12;l++,x++)
{
if(x==6)
while(x!=9)
{
printf(" ");
printf("*");
x++;
}
else
printf(" "); 
}
ln=ln++;
printf(" ");
printf("*");
if(w<3)
{ for(x=0;x<8;x++)
printf(" ");
for(x=0;x<3;x++)
{
printf("*");
printf(" ");
}
}
else
if(w<6)
{
for(x=0;x<7;x++)
printf(" ");
for(x=0;x<3;x++)
{
printf(" ");
printf("*");
}
printf(" ");
}
else
{
for(x=0;x<14;x++)
printf(" ");
// printf("*");
}
w=w++;

for(y=0;y<6;y++)
printf(" ");
printf("*");

printf("\n");
}
for(x=0;x<24;x++)
{
printf(" ");
printf("*");
}
printf("\n created by usman siddique");
getch();
return 0;

}


Monday, January 12, 2015

Basic Syntax of PHP

PHP stands for PHP: Hypertext Preprocessor.


A PHP script can be placed anywhere in the document.

A PHP script starts with <?php and ends with ?>:

<?php
// PHP code goes here
?>

The default file extension for PHP files is ".php".

A PHP file normally contains HTML tags, and some PHP scripting code.


Sunday, January 4, 2015

Sound Function in C or C++

In Both C and C++:
--------------------------------------
#include<dos.h>
#include<iostream.h>
 void main()
{
   int a;
   for ( a = 200 ; a <= 1000 ; a = a + 20 )
   {
      sound(a);
      delay(25);
   }
   nosound();
}

------------------------------------------
You can also do like that in C++ :

#include<iostream.h>
#include<conio.h>
void main()
{
cout<<"\a --------- \a -------- \a";
getch();
}

--------------------------------------
You can also do like that in C Language :

#include<stdio.h>
#include<conio.h>
void main()
{
printf("\a --------- \a -------- \a");
getch();
}










First Hello World Android Program

Please follow below give steps for create First Hello World Android Program in eclipse :-
Step 1:Install  new version of android supported Eclipse
Step 2:After install the eclipse go in File Section
First Hello World Android Program-1
Step 3:File->new->Android Application Project

 First Hello World Android Program-1

Step 4:After click on Android Application project
Step 5:Type Application Name,First letter Must be in uppercase
First Hello World Android Program-3
Step 6:Click on Next->Next->Next->Next
step 7:choose the Activity Name
First Hello World Android Program-7
Step 8:Click on Finish button

Your Android project is ready to work.Your project have following sections and these section have following file and what is use of these files and folders
1.src folder:-this folder contain package of your project
this package have classes where you want to coding and implement functional activity in your project.
2.gen folder:-it have supported package that used to run your project
3.Android 4.4.2(Android version 19):-contain android .jar file
4.Android Dependencies:-have the other outer supported .jar files
5.Referenced Libraries:-it have reference libraries like Android-support-v4 .jar file
6.bin folder:in bin folder .class and .apk file are create after “run” the project
7.lib folder:-it have current running libraries,you also add external .jar file in bin folder
8.res folder:-in drawable folder you add the images that is used in your project.
9.layout folder:-create .xml file in layout folder.it is a very important part in project,by this you design your project.
values folder:-you add your style,color .xml file
10.Android Manifest.xml file:-it is very important file in android project.it having following information
a)android version information
b)package name
c)SDK version information
d)when .xml file open first when project is run.
Source Code :-
Helloworld.java
package com.example.helloworld;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

Saturday, January 3, 2015

Get the current local time with ctime [C++]

#include <iostream>
#include <ctime>

int main()
{
  time_t currentTime;
  struct tm *localTime;

  time( &currentTime );                   // Get the current time
  localTime = localtime( &currentTime );  // Convert the current time to the local time

  int Day    = localTime->tm_mday;
  int Month  = localTime->tm_mon + 1;
  int Year   = localTime->tm_year + 1900;
  int Hour   = localTime->tm_hour;
  int Min    = localTime->tm_min;
  int Sec    = localTime->tm_sec;

  cout << "This program was exectued at: " << Hour << ":" << Min << ":" << Sec<<endl ;
  cout << "And the current date is: " << Day << "/" << Month << "/" << Year <<endl;
  return 0;
}