Sunday, September 8, 2019

Font and Basefont tag of html in a very easy way.


Difference between font and basefont tag in html:-

Font tag is a container tag. Basefont tag is empty tag.
We can apply font tag in a body tag where we want to do the formatting(for a particular text) but we can write basefont tag anywhere in the body tag and it will applied to the whole text of the body except the font tag style.(it will not applied to the text where we write font tag.)

Font tag is container tag so it will have opening as well as closing tag but basefont tag is a empty tag so it will not have closing tag.

Example of <font> and <basefont> tag with explanation.

<html>
<head>
<title>srps</title>
</head>
<body>
<font face="Times New Roman" color="Green" size="50px">This is SRPS. It is a very beautiful CBSE school in UP.

We get theoretical as well as practical knowledge  here. Our faculties are best in the world.</font>
<basefont color="#00ffaa" size="20px" face="Arial" >
<p>Chandrayan-2 was great mission of India but unfortunately we got some problem in it. People of my country is

having belive in ISRO scientist.<p>
Basti is a city of UP. It is located in east UP. In Basti there are many CBSE schools. SRPS is the one of the best school in UP.
</body>
</html>

Note- <Basefont tag is not supported by html 5 as well as most of the browser like chrome,internet explorer, Mozilla do not support this tag. This is the reason in my example we are not able to see the effect of basefont tag.

             

Monday, September 2, 2019

html form example for those students who are good in html table.

<html>
<head>
<title>Form design</title>
</head>
<body bgcolor="#00ffaa" text="red">
<h1 align="center"><i>Demo Form</i></h1>
<form action="table.html" method="post">
<table align="center" border="5px" bordercolor="#ffaadd" cellspacing="10px" cellpadding="12px" width="70%">
<tr>
<th colspan="2">FirstName:</th>
<td colspan="2"><input type="text" name="t1" placeholder="firstName"></td></tr>
<tr>
<th colspan="2">LastName:</th>
<td colspan="2"><input type="text" name="t2" placeholder="LastName"></td>
</tr>
<tr>
<th colspan="2">Email:</th>
<td colspan="2"><input type="email" name="t3" placeholder="EmailId"></td></tr>
<tr>
<th colspan="2">Password:</th>
<td colspan="2"><input type="password" name="t4" placeholder="password"></td></tr>
<tr>
<th>Language Known:</th>
<th><input type="checkbox" name="cb1" value="Hindi" checked>:Hindi</th>
<th><input type="checkbox" name="cb2" value="English">:English</th>
<th><input type="checkbox" name="cb3" value="Urdu">:Urdu</th></tr>
<tr>
<th>Select Your Gender:</th>
<th><input type="radio" name="r" value="Male" checked>:Male</th>
<th><input type="radio" name="r" value="Female">:Female</th>
<th><input type="radio" name="r" value="Other">:Other</th></tr>
<tr>
<th colspan="2">Select Your State:</th>
<td colspan="2"><select>
<option value="selected">Select</option>
<option value="uttarpradesh">uttarpradesh</option>
<option value="Maharastra">Maharashtra</option>
<option value="Andhrapradesh">Andhrapradesh</option>
<option value="uttarpradesh">uttarpradesh</option>
<option value="Madhyapradesh">Madhyapradesh</option>
<option value="Kerala">Kerala</option>
</select></td></tr>
<tr>
<th colspan="2">Which Social Site you mostly use:</th>
<td colspan="2"><datalist id="k">
<option value="Facebook"></option>
<option value="Whatsapp"></option>
<option value="Twitter"></option>
<option value="Instagram"></option>
<option value="Orkut"></option>
<option value="Messanger"></option>
</datalist>
<input list="k"></td></tr>
<tr>
<td colspan="4" align="center"><input type="submit" value="submit"></td></tr>
</table>
</form>
</body>
</html>


Html Form example with almost all its tags.

<html>
<head>
<title>Form design</title>
</head>
<body bgcolor="yellow" text="red">
<h1 align="center">Demo Form</h1>
<form action="table.html" method="post">
<center>
<h3>FirstName:<input type="text" name="t1" placeholder="firstName"></h3><br>
<h3>LastName:<input type="text" name="t2" placeholder="LastName"></h3><br>
<h3>Email:<input type="email" name="t3" placeholder="EmailId"></h3><br>
<h3>Password:<input type="password" name="t4" placeholder="password"></h3><br>
<h3>Language Known:<input type="checkbox" name="cb1" value="Hindi">:Hindi
<input type="checkbox" name="cb2" value="English">:English
<input type="checkbox" name="cb3" value="Urdu">:Urdu</h3><br>
<h3>Select Your Gender:<input type="radio" name="r" value="Male">:Male
<input type="radio" name="r" value="Female">:Female
<input type="radio" name="r" value="Other">:Other</h3><br>
<h3>Select Your State:<select>
<option value="selected">Select</option>
<option value="uttarpradesh">uttarpradesh</option>
<option value="Maharastra">Maharashtra</option>
<option value="Andhrapradesh">Andhrapradesh</option>
<option value="uttarpradesh">uttarpradesh</option>
<option value="Madhyapradesh">Madhyapradesh</option>
<option value="Kerala">Kerala</option>
</select></h3><br>
<h3>Which Social Site you mostly use:<datalist id="k">
<option value="Facebook"></option>
<option value="Whatsapp"></option>
<option value="Twitter"></option>
<option value="Instagram"></option>
<option value="Orkut"></option>
<option value="Messanger"></option>
</datalist>
<input list="k"></h3><br>
<input type="submit" value="submit">
</center>
</form>
</body>
</html>


Sunday, September 1, 2019

Best example for understanding Rowspan and colspan in html.

<html>
<head>
<title>table</title>
</head>
<body>
<table border="5px">
<tr>
<th colspan="8">Marks Details</th>
</tr>
<tr>
<th rowspan="2">Roll no.</th>
<th rowspan="2">Name</th>
<th rowspan="2">English</th>
<th colspan="3">Science</th>
<th rowspan="2">Math</th>
<th colspan="2">FIT</th>
</tr>
<tr>
<td>Physics</td>
<td>chemistry</td>
<td>Bio</td>
</tr>
<tr>
<td>1</td>
<td>Arjun</td>
<td>45</td>
<td>23</td>
<td>14</td>
<td>111</td>
<td>10</td>
<td>13</td>
</tr>
<tr>
<td>2</td>
<td>Rohan</td>
<td>45</td>
<td>23</td>
<td>14</td>
<td>111</td>
<td>10</td>
<td>13</td>
</tr>
<tr>
<td>3</td>
<td>Rajan</td>
<td>45</td>
<td>23</td>
<td>14</td>
<td>111</td>
<td>10</td>
<td>13</td>
</tr>
</table>
</body>
</html> 

Wednesday, October 24, 2018

How inheritance is related with constructor


Saturday, October 13, 2018

Friend Function and Friend class in C++

Friend Function:-

A friend function of a class will be the friend of that class. It will not be the member of that class but it has authority to access all the member of that class even they are private or protected. A friend function can be written in any scope of the class like private, protected and public. 

A friend function declaration will be in the class preceded by friend keyword and its declaration will be outside. 

A friend function is not a member function  (not a part of the object) of the class that means it will not be called by the object name. It is called directly by writing the name of the function with brackets. 

Syntax of friend function declaration:- 

friend return-type function-name(class object);

Syntax of friend function definition:-

return-type function name(class object) 

{

           Statements;

}

#include <iostream>
#include<conio.h>
using namespace std;
class pramod
{
private:
    int a,b;
public:
    friend void add1(pramod s);
    void add2()
    {
        cout<<"Hello"<<endl;
    }
    pramod()
    {
        a=10;
        b=20;
    }
};
void add1(pramod s1)
{
    cout<<s1.a<<endl<<s1.b<<endl;
}
int main()
{
    pramod ob1;
    ob1.add2();
    add1(ob1);
}



Friend Class :-

If we want to make class as a friend function then it well be done by writing the class name preceded by keyword friend. 

Like friend function it can also access all the member function as well as data member of that class where it is defined. It can access all of type of data and member function define in any scope like public, protected and private.



 

  

Nested Class in C++

Nested Class:-

If a class declared inside another class is known as nesting of classes. The outer class is known as enclosing class and the inner class is known as nested class.

A nested class is a member of outer or enclosing class so all the so it will have same access right as other member function contains. 

Inner class object must be preceded the outer class name with scope resolution operator(: :). 

                     
    
#include <iostream>

#include<conio.h>

using namespace std;

class Outer

{

    int a;

public:

    int c;

//private:

    class inner

    {

         int d;

     public:

        int e;

        void show1()

        {

            cout<<"private variable is called in public member function="<<d*d<<endl;

        }

        inner()

        {

            d=10;    // Initialize the inner class variable at the time of object call.

            e=20;

        }

    };

    inner ob1;      //private scope object of inner class.

     public:

        inner ob2;  // public scope object of inner class.

    void show2()

    {

        ob1.show1(); //ob1 Behaves as a private variable of outer class.

        show();

    }

    Outer()

    {

        a=30;

        c=40;

    }

     private:

        void show()

        {

            ob2.show1();

        }


};

int main()

{

    Outer ob;

    //inner in;            // we can not make object of inner class directly.

    Outer::inner oi;     // we can not make object of private inner class. inner class must be public.

    oi.show1();

    ob.show2();

    return 0;

}





Font and Basefont tag of html in a very easy way.

Difference between font and basefont tag in html:- Font tag is a container tag. Basefont tag is empty tag. We can apply font tag in a ...