google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: June 2013

Wednesday, June 26, 2013

HTML language

    Welcome to the world of HTML that is full form of:
  • H - Hyper
  • T - Text
  • M - Markup
  • L - Language
       HTML is used to make web pages.The meaning of HTML is:
Hyper is the opposite of linear.Old -fashioned computer programs were necessarily linear -that is ,they had a specific order.But  with a "hyper" language such as HTML,the user can go anywhere on the web page at any time.
Text is just what you're looking at now -English characters used to make up ordinary words.
Mark-up is what is done to the text to change its appearance.For instance,"marking up" your text with <b> before it and </b> after it will put that text in bold.
Language is just that.HTML is the language that computers read in order to understand web pages.

A mark-up language is set of mark-up tags.HTML uses mark-up tags to describe we pages.
Note that HTML is not a programming language,it is a mark-up language.

Advantages of HTML:-

  1. It's easy to use.
  2. It is supported on the majority of browsers, in fact ,may be even all of them.
  3. It is widely used on all websites.
  4. It will cost you nothing.It is free.
  5. Easy to learn.
  6. Loose syntax.
  7. Very similar to XML syntax,which is increasingly used for data storage.
  8. Free -You need not to buy any software.

Structure of HTML document:-

An HTML document is made up of two sections:-
1)THE HEAD SECTION :- The head section contains information related to the webpage.Example the title of the document.Any data which is provided in the Head Section will not appear in the viewing area of the web browser.We use Head tag as<head> and</head>The tags used within this tag are TITLE,SCRIPT.
2)THE BODY SECTION:- All information contained in the browser section is displayed in the browser.The way in which this information is to be displayed is instructed to the browser with the help of HTML tags.We use <body> and </body> tag for it.The tags used in this tag are all the tags of symbols like bold,paragraph,italic,horizontal rule,etc.

The structure of the HTML document is as follows:-
<html>
<head>
<title> My first html document</title>
</head>
<body>
<h1>My first heading</h1>
<p>My first Paragraph.</p>
</body>
</html>

Explanation of above coding  is:-
  • - The text between <html> and </html> describes the web page.
  • - <title>This is the name that your browser will use to identify the page.
  • -<head> This encloses basic information about your page.Your title and meta tags go here as well as any scripts you want executed before the main part of the page loads.
  • -The text between <body> and </body> is the visible page content 
  • - The text between <h1> and </h1> is displayed as a heading
  • - The text between <p> and </p> is displayed as a paragraph.
The editor for html used mostly is notepad after typing the html coding you have to save the file with a name given by user but the extension should be .html or .htm for that file and saved on your place.

Tags :- 

A tag is a unit of markup.These are used to define elements in HTML. Each consists of the "less than" and "greater than" characters (< and >) with the element name and possibly some attributes and values inside.

Star Tag and End Tag:

Start Tag:- Start tags are used to begin an effect .A start tag begins with(<) sign by the tag element and ends with the (>) sign.

End Tag:-The end tags are used to end the effect.An end tag also begins with (<) sign ,it has an additional forward slash(/) immediately after  the less than (<) sign. This is followed by the keyword and the tag is closed with the greater than (>) sign.
e.g. Start Tag : <title>
        End Tag : </title>
 It is between the start tag and the end tag that you have to insert the text to which the effect of the tag is to be applied.

Tags in HTML:-
  • Table                  
  • Lists                   
  • Paragraph           
  • Physical styles     
  • Logical styles
  • Horizontal Rule
  • Break Line
  • Image
  • Anchor
  • Marquee
  • Subscript
  • Superscript
Tag Attributes:-
       Tag can have attributes.Attributes can provide additional information about the HTML elements on your page,included inside the start tag.
Attributes always come in name/value pairs like this: name="value"
Syntax is
         <tag_name attribute_name="value">
       e.g.<img src="C:\image.jpg">
In above example src is an attribute for image tag and its values are specified in double quotes.

HTML is the language which can be used embedded with many languages as to make front end forms like with PHP,ASP.NET,etc.

The language is easy to learn and understand .
Heading tag :- There are six heading tags They are:-
<h1>ABC</h1>
<h2>ABC</h2>
<h3>ABC</h3>
<h4>ABC</h4>
<h5>ABC</h5>
<h6>ABC</h6>
The Heading tag is used to heading h1 tag is used to display words in large size and h6 is used to write  in smallest size.

Scripting Languages:-We can use Javascript or vbscript languages with HTML.

Thursday, June 13, 2013

C++ Programs Examples

In Microsoft Visual C++ 6.0 (Text Editor)-
Follow the steps:-
Step1:-


 Step 2:-


Step 3:-

Step 4:-

Step 5:-

Step 6:-

Step 7:-

Step 8:-

Step 9:-

Step 10:-

Step 11:-

Step 12:-

Step 13:-



Step 14:-

Step 15:-

Step 16:-



1. Program to Display Simple Message:-
#inlude<iostream.h>
void main()
{
cout<<"Welcome to my blog.\n";
cout<<"Thank you for visiting my blog.";
 }
/*************************Output**************************/
Welcome to my blog.
Thank you for visiting my blog.

2. Program to find addition of first 100 numbers:-
#include<iostream.h>
void main()
{
int sum=0,i;
for(i=1;i<100;i++)
{
sum=sum+i;
}
cout<<"Addition of first 100 numbers is:-"<<sum;

}
/*************************Output**************************/
Addition of first 100 numbers is:-5050

3. Program to compute sum of the series:12+22+32+42+....+n2
The value of n should be accepted from user.
#include<iostream.h>
void main()
{
int n,a=1,b,sum=0;
cout<<"Enter the limit n:-";
cin>>n;
do
   {  
       b=a*a;
       sum+=b;
       a++;
    }
while(a<=n);
cout<<"Sum of the series = "<<sum<<endl;
}
/*************************Output**************************/
Enter the limit n:-5
Sum of the series =55
4. Program to convert binary number to decimal number
#include<iostream.h>
#include<math.h>
void main()
  {
  int a[10],i,no,j,r=0;
  double sum=0;
  cout<<"Enter Binary Number:-";
  cin>>no;
  i=0;
  while(no>0)
     {
         a[i]=no%10;
         no=no/10;
         i++;
     }
  for(j=0;j<i;j++)
    {
      sum=sum+a[j]*pow(2,r);
      r++;
     }
  cout<<"Decimal Number Is:"<<sum<<endl;
  }
/*************************Output**************************/
Enter Binary Number:-111
Decimal Number Is:-7


5.Program to calculate factorial using recursion function:-
int factorial(int n);
#include<iostream.h>
void main()
{
int n,f;
cout<<"Enter the number of which factorial is to be find:-";
cin>>n;
f=factorial(n);
cout<<"Factorial is :-"<<f;
}
 int factorial(int n)
  {
      int fact=1;
      if(n==1)
          {
                  return1;
           }
          else
           {
              fact=factorial(n-1)*n;
              return(fact);
            }
}
/*************************Output**************************/
Enter the number of which factorial is to be found:-3
Factorial is :-6


6.Program to print the square root of given numbers using standard (built-in ) library function:-
#include<iostream.h>
#include<math.h>
void main()
{
 double n;
 cout<<"Enter a positive number:-";
 cin>>n;
  while(n>0)
   {
    cout<<"Square root of"<<n<<"is:-"<<sqrt(n)<<endl;
   cout<<"Enter the next number or enter 0 to quit:-";
   cin>>n;
  }
}
/*************************Output**************************/
Enter a positive number:-81
Square root of 81 is:-9
Enter the next number or enter 0 to quit:-4
Square root of 4 is:-2
Enter the next number or enter 0 to quit:-0

NOTE:- the above program prints the square root of given numbers using standard (built in) library function sqrt() present in <math.h> file, till the number entered is greater than 0. 

7.C++ Program to display:-
12345
1234
123
12
1
#include<iostream.h>
int main()
{
 int n=5,m=n,i,j;
  for(i=0;i<n;i++)
   { 
       for(j=1;j<=m;j++)
           {
              cout<<j;
            }
         cout<<endl;
          m--;
     }
  return 0;
}

Explanation:- In the above program second for loop is nested inside the first for loop.Each iteration of first for loop(i) will print one row and second for loop (j) iterates,from (1 to m) for each of the iteration of first for loop .Here newline and m decrement and decrement is given outside the second for loop and inside the first for loop so that output for each of the number is printed on a separate line.

8.C++ program to diplay:-
1
12
123
1234
12345
#include<iostream.h>
int main()
{
  int  n=5,m=1,i,j;
    for(i=0;i<n;i++)
       {
          for(j=1;j<=m;j++)
              {
                 cout<<j;
               }
          cout<<"\n";
          m++;
        }
     return 0;
}

Explanation:- In the above program for i=0 check i<n if true then for j=1 and check condition j<=m if true then print j then on next line again for i= 1 check i<n if true then for j=2 and so on and display the output
   


9.C++ program to generate Fibonacci series using while loop.
#include <iostream.h>
int main()
{
    int current=0,prev=0,prev2=1,fibnum;
    cout<<"Enter the number of Fibonacci numbers to compute = ";
    cin>>fibnum;
    cout<<”Fibonacci Series = ”;
    if(fibnum <=0)
          {
        cout<<"Error: Enter a positive number: ";
          }
    while(fibnum--)
          {
        cout<<prev ;
        current=prev + prev2;
        prev=prev2;
        prev2=current;
        if(fibnum)
            cout<<",";
          }
    cout<<endl;
    return 0;
}
/*************************Output**************************/
Enter the number of Fibonacci numbers to compute = 10
Fibonacci Series = 0,1,1,2,3,5,8,13,21,34

10.To write C++ program to decide the day of a week using switch-case.
#include <iostream.h>
void main()
{
          int day;
          cout<<”Enter number in the range of 1 to 7 to get corresponding day = ”;
          cin>>day;
          switch(day)
          {
                    case 1: cout<<”Today is Sunday”;
                              break;
case 2: cout<<”Today is Monday”;
                              break;
case 3: cout<<”Today is Tuesday”;
                              break;
case 4: cout<<”Today is Wednesday”;
                              break;
case 5: cout<<”Today is Thursday”;
                              break;
case 6: cout<<”Today is Friday”;
                              break;
case 7: cout<<”Today is Saturday”;
                              break;
default: cout<<”Not a valid day”;
                              break;
         }
}
/*************************Output**************************/
Enter number in the range of 1 to 7 to get corresponding day = 4
Today is Wednesday

11.C++ program to print the square root and raise to power of given numbers using standard (built in) library function.
#include <iostream.h>
#include<math.h>
void main()
{
          double number,x,y;
         cout<<"Enter a positive number = ";
         cin>>number;
              while(number>0)
                      {
                              cout<<"Square root of "<<number<<" is = "<<sqrt(number)<<endl;
                              cout<<"Enter the next number or enter 0 to quit = ";
                              cin>>number;
                      }
          cout<<"Enter the value of x = ";
          cin>>x;
          cout<<"Enter the value of y = ";
          cin>>y;
          cout<<x<<" raise to "<<y<<" is = "<<pow(x,y)<<endl;
}
/*************************Output**************************/
Enter a positive number = 64
Square root of 64 is = 8
Enter the next number or enter 0 to quit = 81
Square root of 81 is =9
Enter the next number or enter 0 to quit =0
Enter the value of x = 5
Enter the value of y = 4
5 raise to 4 is = 625
 
12.Write C++ program to calculate the area of circle and rectangle using overloaded function area.
double area(int);
int area(int,int);
#include<iostream.h>
void main()
{
          int r,l,b;
          double ac,ar;
          cout<<"Enter the value of  Length = ";
          cin>>l;
           cout<<"Enter the value of Breadth = ";
          cin>>b;
          ar=area(l,b);
          cout<<"Area of rectangle is = "<<ar<<endl;
          cout<<"Enter the value of radius =";
          cin>>r;
          ac=area(r);
          cout<<"Area of circle is = "<<ac;
}
double area(int r)
{       
    double area1;
          const double pi=3.14;
          area1=(pi*r*r);
          return area1;
}
int area(int l,int b)
{       
    int area2=l*b;
          return area2;
}
/*************************Output**************************/
Enter the value of Length = 3
Enter the value of Breadth = 5
Area of rectangle is = 15
Enter the value of radius = 3
Area of circle is = 28.26

13.C++ program to swap two numbers using functions.
#include<iostream.h>
void swap(int *,int *);
void main()
{
          int var1,var2,tmp;
          cout<<”Enter value of Variable 1:”;
          cin>>var1;
          cout<<”Enter value of Variable 2:”;
          cin>>var2;
          cout<<”Values of variables before Function Call:”;
          cout<<var1<<”/t”<<var2;
          swap(&var1,&var2);
          cout<<”\nValues of variables after Function Call:”;
}
void swap(int *a,int *b)
{
          int tmp;
          tmp=*a;
          *a=*b;
          *b=tmp;
}
/*************************Output**************************/
 Enter value of Variable1:3
Enter value of Variable2:4
Values of variable before Function Call: 3 4
Values of variable after Function Call: 4   3

14 .C++ program to count the words in text:-
#include<iostream.h>
#include<string.h>
void main()
{
    int i,len,w=0;
    char line[80];
    cout<<"Type your text:-";
    cout<<"\n";
    cin.getline(line,80);
    len=strlen(line);
    for(i=0;i<len;i++)
    {
        if(line[i]==' ')
            w++;
    }
    cout<<"Words in text typed by you are = "<<w+1;
    cout<<"\n";
}


Output:-
 Type your text:-
Welcome to the blog - Vijay Marwaha
Words in text typed by you are =7

रघुपति राघव राजाराम पतित पावन सीताराम ॥

 रघुपति राघव राजाराम पतित पावन सीताराम ॥ सुंदर विग्रह मेघश्याम गंगा तुलसी शालग्राम ॥ भद्रगिरीश्वर सीताराम भगत-जनप्रिय सीताराम ॥  जानकीरमणा स...