<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Information Village &#187; Learn C++</title>
	<atom:link href="http://www.info-village.info/category/learn-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.info-village.info</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 21 Feb 2010 11:41:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nested Structure</title>
		<link>http://www.info-village.info/nested-structure/</link>
		<comments>http://www.info-village.info/nested-structure/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 11:27:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/?p=778</guid>
		<description><![CDATA[Nested Structure:
 When members of a structure are defined as structure type, these are called nested structures. For example: 
 
struct info 
{ 
char s_name[15]; 
char f_name[15] ; 
char city[15] ; 
int age; 
}; 
struct p_data 
{ 
info s1; 
info s2; 
float x;
}; 
p_data rec; 




 
 In the above example, info structure is defined [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;"><span style="font-size: small;">Nested Structure</span></span></strong><strong><span style="font-size: small;">:</span></strong></p>
<p><strong><span style="font-size: small;"> </span></strong><span style="font-size: small;">When</span><span style="font-size: small;"> members of a structure are defined as structure type, these are called nested structures. For example: </span><br />
<span style="font-size: small;"> </span></p>
<p><strong><span style="font-size: small;">struct info </span></strong><br />
<strong><span style="font-size: small;">{ </span></strong><br />
<strong><span style="font-size: small;">char s</span></strong><strong><span style="font-size: small;">_name[15]; </span></strong><br />
<strong><span style="font-size: small;">char f_</span></strong><strong><span style="font-size: small;">name[15] ; </span></strong></p>
<p><strong><span style="font-size: small;">char city[15] </span></strong><strong><span style="font-size: small;">; </span></strong><br />
<strong><span style="font-size: small;">int age; </span></strong><br />
<strong><span style="font-size: small;">}; </span></strong><br />
<strong><span style="font-size: small;">struct p_data </span></strong><br />
<strong><span style="font-size: small;">{ </span></strong><br />
<strong><span style="font-size: small;">info s1; </span></strong><br />
<strong><span style="font-size: small;">info s2; </span></strong><br />
<strong><span style="font-size: small;">float x;</span></strong></p>
<p><strong><span style="font-size: small;">}; </span></strong><br />
<strong><span style="font-size: small;">p_data rec; </span></strong></p>
<p><span style="font-size: small;"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</span><strong><span style="font-size: small;"><br />
</span></strong></p>
<p><span style="font-size: small;"> </span></p>
<p style="text-align: justify;"><span style="font-size: small;"> </span><span style="font-size: small;">In the above example,</span> <strong><span style="font-size: small;">info</span></strong> <span style="font-size: small;">structure is defined with four member</span><span style="font-size: small;">s. The structure </span><strong><span style="font-size: small;">p_data</span></strong> <span style="font-size: small;">is defined after the </span><span style="font-size: small;">info </span><span style="font-size: small;">and it contains three members; </span><span style="font-size: small;">two </span><span style="font-size: small;">are of structure type and one of float type. The members s1</span><span style="font-size: small;"> and s2 within the struct</span><span style="font-size: small;">ure are the nested structures. </span><span style="font-size: small;">The structure variable </span><strong><span style="font-size: small;">rec</span></strong><span style="font-size: small;"> is of nested structure type. It is like a structure of array. The structures can he nested to any degree.</span></p>
<p><span style="font-size: small;"> </span></p>
<p><strong><span style="text-decoration: underline;"><span style="font-size: small;">Initialization of Nested Structures</span></span></strong><strong><span style="font-size: small;">:</span></strong></p>
<p style="text-align: justify;"><strong><span style="font-size: small;"> </span></strong><span style="font-size: small;">The structure variable that contains members of structure type is initialized as the stru</span><span style="font-size: small;">cture of array is initialized. </span><span style="font-size: small;">For example, the above structure variable </span><span style="font-size: small;">“rec” </span><span style="font-size: small;">may he initialized as: </span><br />
<strong><span style="font-size: small;">p_data rec </span></strong><strong><span style="font-size: small;">= </span></strong><strong><span style="font-size: small;">{{“John”, “William”, </span></strong><strong><span style="font-size: small;">London</span></strong><strong><span style="font-size: small;">”, </span></strong><strong><span style="font-size: small;">20) </span></strong><strong><span style="font-size: small;">{“</span></strong><strong><span style="font-size: small;">Joseph</span></strong><strong><span style="font-size: small;">”</span></strong><strong><span style="font-size: small;">, “</span></strong><strong><span style="font-size: small;">Anthony”, “</span></strong><strong><span style="font-size: small;">Canada</span></strong><strong><span style="font-size: small;">”, 30}</span></strong><strong><span style="font-size: small;">, 6.9}; </span></strong></p>
<p><span style="font-size: small;"> </span></p>
<p><strong><span style="text-decoration: underline;"><span style="font-size: small;">Accessing Members of Nested Structures</span></span></strong><strong><span style="font-size: small;">:</span></strong></p>
<p style="text-align: justify;"><strong><span style="font-size: small;"> </span></strong><span style="font-size: small;">The members of nested structures arc accessed in the same way as the members of simple structures arc accessed. However, to access</span><span style="font-size: small;"> members of nested structures</span><span style="font-size: small;">, more than one dot operators are used. </span></p>
<p><span style="font-size: small;">For example: </span><br />
<span style="font-size: small;"> </span></p>
<p><strong><span style="font-size: small;">r</span></strong><strong><span style="font-size: small;">ec.s1.age =</span></strong> <strong><span style="font-size: small;">22; </span></strong><br />
<strong><span style="font-size: small;"> </span></strong></p>
<p style="text-align: justify;"><span style="font-size: small;">In the</span><span style="font-size: small;"> above statement </span><strong><span style="font-size: small;">rec</span></strong><span style="font-size: small;"> is the name of the structure variable, </span><strong><span style="font-size: small;">s1</span></strong> <span style="font-size: small;">is member of structure </span><strong><span style="font-size: small;">p_d</span></strong><strong><span style="font-size: small;">ata</span></strong> <span style="font-size: small;">and </span><strong><span style="font-size: small;">age</span></strong> <span style="font-size: small;">is the member of structure </span><span style="font-size: small;">info. </span></p>
<p style="text-align: justify;"><span style="font-size: small;"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/nested-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Structure Variables as Arrays</title>
		<link>http://www.info-village.info/structure-variables-as-arrays/</link>
		<comments>http://www.info-village.info/structure-variables-as-arrays/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 12:14:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/structure-variables-as-arrays/</guid>
		<description><![CDATA[Structure Variables as Arrays:
 A structure variable may also be declared as an array. This is done to manage a large number of records. Each variable of the array represents a complete record.
For example, in the following example the structure variable arts are of array type. It contains 10 elements. Each element can store one [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Structure Variables as Arrays</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>A structure variable may also be declared as an array. This is done to manage a large number of records. Each variable of the array represents a complete record.<br />
For example, in the following example the structure variable arts are of array type. It contains 10 elements. Each element can store one record.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p><strong>struct result<br />
{<br />
char s_name [15];<br />
int sub [4] ;<br />
int total;</strong></p>
<p><strong>};<br />
result arts [10]; </strong></p>
<p style="text-align: justify;">There are three members of the above structure. Each member is accessed by one element of the <strong>arts</strong> array. The indexed variables are used to access these records. The index of first element or record is <strong>arts [0]</strong>. Similarly, the last record is <strong>arts [9]</strong>.</p>
<p><strong><span style="text-decoration: underline;">Initialization of Array of Structure</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>Like an array, the data into array of structure variables can also be assigned at the time of its declaration.<br />
For example, in the following example the structure variable “<strong>rec</strong>” has three elements. The data of fields of each record is enclosed in braces and is separated by commas.</p>
<p><strong>struct marks<br />
{<br />
char code [10];<br />
char name[15];<br />
float marks;<br />
}<br />
marks rec [3] = {{“man-1”, “James ”, 45. 9},<br />
{“acc-l”, “John”, 45.9},<br />
{“fac-l”, “William”, 55.8}};</strong></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/structure-variables-as-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Array Type Members of Structures</title>
		<link>http://www.info-village.info/array-type-members-of-structures/</link>
		<comments>http://www.info-village.info/array-type-members-of-structures/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 14:24:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/?p=769</guid>
		<description><![CDATA[Array Type Members of Structures:
The members of structure may be of different types. These can also be simple variables or array variables.
For example, in the following structure, the member “sub” is an array of int type. It has four elements. The member “name” is of string type and a string is also an array.
struct rec
{ [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Array Type Members of Structures</span>:</strong></p>
<p style="text-align: justify;">The members of structure may be of different types. These can also be simple variables or array variables.</p>
<p style="text-align: justify;">For example, in the following structure, the member “<strong>sub</strong>” is an array of int type. It has four elements. The member “<strong>name</strong>” is of string type and a string is also an array.</p>
<p><strong>struct rec<br />
{ </strong></p>
<p><strong>char name [15];<br />
int sub [4]</strong></p>
<p><strong>};</strong></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p style="text-align: justify;">Method to access the elements of an array that is a member of a structure is the same as for other members. The dot operator is used. To access a specific element of an array of a member, its index value or subscript is used. The variable of a structure type that has an array member is initialized in the usual manner. The members of the array are initialized in the same sequence in which they are defined in the structure.<br />
For example, in the following example, the member “<strong>sub</strong>” is initialized in the same way as an array variable is initialized.</p>
<p><strong>struct result<br />
</strong><strong>{<br />
char name [15];<br />
int sub [4] ;<br />
int total;<br />
result student = {“John”, {62,69,70,40},0}; </strong></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/array-type-members-of-structures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Initialization of Structure Variables</title>
		<link>http://www.info-village.info/initialization-of-structure-variables/</link>
		<comments>http://www.info-village.info/initialization-of-structure-variables/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 12:55:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/initialization-of-structure-variables/</guid>
		<description><![CDATA[Initialization of Structure Variables:
 The values into a structure variable can be assigned when it is declared. It is called initialization of the structure variable. To initialize a structure variable, data is assigned to the members of the structure. To assign data to the members of the structure, the data items are written in the [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Initialization of Structure Variables</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The values into a structure variable can be assigned when it is declared. It is called initialization of the structure variable. To initialize a structure variable, data is assigned to the members of the structure. To assign data to the members of the structure, the data items are written in the same order in which these have been defined in the structure. The type of the data must also correspond to the type of the member of the structure.</p>
<div style="FLOAT: left"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "2144048671";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<p style="text-align: justify;">For example, in the structure “<strong>add</strong><strong>ress</strong>”, member city is of character type and is the first member. The value that is to be assigned to it must be of character type and is written first. Similarly, the second member is <strong>pcode</strong>. The value that is to be assigned to it must be of integer type and is written second.</p>
<p><strong>struct address<br />
{<br />
char city [15] ;<br />
int pcode;<br />
}<br />
address tag {“London”, 78500};</strong></p>
<p><strong> </strong></p>
<p><strong><span style="text-decoration: underline;">Program</span>:</strong></p>
<p style="text-align: justify;">Write a program to define a structure with five members. The first member is student name and the other he marks obtained in subjects. Assign values to the members during their declaration. Add the marks of subjects to calculate total marks and then print these numbers and the total marks of the student.</p>
<p><strong>#include &lt;iostream.h&gt;</strong></p>
<p><strong>#include &lt;conio.h&gt;</strong></p>
<p><strong>main ( )</strong></p>
<p><strong>{</strong></p>
<p><strong>struct rec</strong></p>
<p><strong>{</strong></p>
<p><strong>char name [15];</strong></p>
<p><strong>int s1, s2, s3, s4;</strong></p>
<p><strong>};</strong></p>
<p><strong>rec st01 = {“John”, 91, 92, 89, 98};</strong></p>
<p><strong>int total;</strong></p>
<p><strong>total = st01.s1 + st01.s2 + st01.s3 + st01.s4;</strong></p>
<p><strong>clrscr ( );</strong></p>
<p><strong>cout &lt;&lt; “Name of student : ” &lt;&lt; st01.name &lt;&lt; endl;</strong></p>
<p><strong>cout &lt;&lt; “Marks in Subject 1 : ” &lt;&lt; st01.s1 &lt;&lt; endl;</strong></p>
<p><strong>cout &lt;&lt; “Marks in Subject 2 : ” &lt;&lt; st01.s2 &lt;&lt; endl;</strong></p>
<p><strong>cout &lt;&lt; “Marks in Subject 3 : ” &lt;&lt; st01.s3 &lt;&lt; endl;</strong></p>
<p><strong>cout &lt;&lt; “Marks in Subject 4 : ” &lt;&lt; st01.s4 &lt;&lt; endl;</strong></p>
<p><strong>cout &lt;&lt; “Total Marks :” &lt;&lt; total;</strong></p>
<p><strong>}</strong></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/initialization-of-structure-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Structure Variable</title>
		<link>http://www.info-village.info/structure-variable/</link>
		<comments>http://www.info-village.info/structure-variable/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 13:54:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/?p=758</guid>
		<description><![CDATA[Structure Variables:
 A structure is a collection of data items or elements. It is defined to declare its variables. These are called structure variables. A variable of structure type represents the members of its structure.



When a structure type variable is declared, a space is reserved in the computer memory to hold all members of the [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Structure Variables</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>A structure is a collection of data items or elements. It is defined to declare its variables. These are called structure variables. A variable of structure type represents the members of its structure.</p>
<div style="FLOAT: left"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "2144048671";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<p style="text-align: justify;">When a structure type variable is declared, a space is reserved in the computer memory to hold all members of the structure. The memory occupied by a structure variable is equal to the sum of the memory occupied by each member of the structure.<br />
A structure can be defined prior to or inside the main ( ) function. If it is defined inside the main ( ) function then the structure variables can be declared only inside the main function. If’ it is defined prior to the main ( ) function, its variables can be defined anywhere in the program. To declare a structure variable, the structure is first defined, e.g.</p>
<p><strong>struct address</strong></p>
<p><strong>{<br />
char city [15];<br />
int pcode;</strong></p>
<p><strong>}<br />
address taq, aye;</strong></p>
<p><strong> </strong></p>
<p>In the above example, <strong>city</strong> and <strong>pcode</strong> are the members of structure address. The variable <strong>taq</strong> and <strong>aye</strong> are declared as structure variables. The structure address has two members: city and <strong>pcode</strong>. The variable city occupies 15 bytes and <strong>pcode</strong> occupies 2 bytes. Thus each variable of this structure will occupy 17 bytes space in memory, i.e. 15 bytes for city and 2 bytes for <strong>pcodc</strong>.</p>
<p><strong><span style="text-decoration: underline;">Accessing Members of a Structure</span>:</strong></p>
<p><strong> </strong>The <strong>dot operator </strong><strong>(.)</strong> is used to access the members of a structure. To access a member of a specific structure, the structure variable name, the dot operator and then the member of the structure is written.<br />
The syntax to access a member of a structure is:</p>
<p><strong>struct_variable.struct_element </strong></p>
<p><strong>struct_variable</strong> It specifies the name of the structure variable. A period or full-stop specifies the dot operator.<br />
<strong>struct_element</strong> It specifies the actual element of the structure whose value is to he accessed.</p>
<p><strong><span style="text-decoration: underline;">Program</span>: </strong>Write a program to input data into and then print data from the members of a structure.</p>
<p><strong># include &lt;iostream.h&gt;<br />
# include &lt;conio.h&gt;<br />
struct address<br />
{<br />
char city [15];<br />
int pcode;<br />
main ( )<br />
{<br />
address taq;<br />
clrscr ( );<br />
cout &lt;&lt; “Enter  City ? ”;<br />
cin &gt;&gt; taq.city;<br />
cout &lt;&lt; “Enter Postal Code ? ”;<br />
cin &gt;&gt; taq.pcode;<br />
cout &lt;&lt; “Output from structure” &lt;&lt; endl;<br />
cout &lt;&lt; “City:” &lt;&lt; taq.city &lt;&lt; endl;<br />
cout &lt;&lt; “Postal Code:” &lt;&lt; taq.pcode &lt;&lt; endl;<br />
}</strong></p>
<p style="text-align: justify;">In the above program, a structure <strong>address</strong> is defined. A variable <strong>taq</strong> of this structure is declared. The data is entered into the members of the structure <strong>address</strong> with reference to structure variable <strong>taq</strong>. The dot operator is used between the structure variable <strong>taq</strong> and members of the structure.</p>
<p style="text-align: justify;"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/structure-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ Structures</title>
		<link>http://www.info-village.info/cpp-structures/</link>
		<comments>http://www.info-village.info/cpp-structures/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 15:43:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/?p=753</guid>
		<description><![CDATA[C++ Structures:
 A structure is a collection of related elements or data items. The elements of the structure are called members of the structure. A structure is unlike an array. All elements in an array are of the same type. But in structures, the elements can be of different types.
The syntax of a structure is [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">C++ Structures</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>A structure is a collection of related elements or data items. The elements of the structure are called members of the structure. A structure is unlike an array. All elements in an array are of the same type. But in structures, the elements can be of different types.<br />
The syntax of a structure is very similar to that of a class in C++.  The structures are commonly used in file processing. A file is a collection of related records and a record is a collection of related fields of same or different data type. The structures are also a collection of same or different data types. These are, therefore, also known as records.</p>
<div style="FLOAT: left"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "2144048671";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<p><strong><span style="text-decoration: underline;">Defining a Structure</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>Specifying the names, types and number of data items within a structure is called defining of the structure. The keyword “<strong>struct</strong>” is used to define a structure.<br />
The syntax for defining a structure is:<br />
<strong>struct st_name<br />
{<br />
type 1;</strong><strong><br />
type m;<br />
type n; </strong></p>
<p>Where<br />
<strong>st name</strong> represents the structure name. It is also ca1led <strong>structure tag</strong>. It is used to declare variables 6f structure type.</p>
<p><strong>type</strong> represents the data type of a variable.</p>
<p style="text-align: justify;"><strong>l, m, n</strong> represents members of the structure. These may have different or same data type. The members are enclosed in braces. A semi-colon after the closing brackets <strong>( }; )</strong> indicates the end of the structure. Each member of a structure must have unique name but different structures may have same names.</p>
<p style="text-align: justify;">A structure is first defined and then variables of structure type are declared. A variable of a structure type is declared to access data in the members of the structure.</p>
<p style="text-align: justify;"><strong>Example:</strong> Declare a structure with <strong>address</strong> as tag and having two members <strong>name</strong> of character type and age of integer type.<br />
<strong>struct address<br />
{<br />
char name [15];<br />
int age ;</strong></p>
<p>The structure member <strong>name</strong> is of character type with 15 characters length (including the null character) and <strong>age</strong> is of integer type.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/cpp-structures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Built-In Function of Math</title>
		<link>http://www.info-village.info/built-in-function-of-math/</link>
		<comments>http://www.info-village.info/built-in-function-of-math/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 17:57:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/?p=747</guid>
		<description><![CDATA[Built-In Function of Math:
 The functions that are used to perform mathematical calculations are defined in “math.h” header file. The commonly used math library functions are discussed below.
The “pow” Function:
 It is used to calculate the exponential power of a given integer number.
Its syntax is: pow (x ,y);
 
Where
x : is an integer number whose [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Built-In Function of Math</span>:</strong></p>
<p><strong> </strong>The functions that are used to perform mathematical calculations are defined in “<strong>math.h</strong>” header file. The commonly used math library functions are discussed below.</p>
<p><strong><span style="text-decoration: underline;">The “pow” Function</span>:</strong></p>
<p><strong> </strong>It is used to calculate the exponential power of a given integer number.<br />
Its syntax is: <strong>pow (x ,y);</strong></p>
<p><strong> </strong></p>
<p>Where<br />
<strong>x</strong> <strong>:</strong> is an integer number whose power is to be calculated.<br />
<strong>y</strong> <strong>:</strong> is an integer number that represents the exponent of the number.</p>
<p><strong>Example: </strong>If the value of 2<sup>3</sup> is to be calculated, the function is written as: <strong>pow (2, 3)</strong></p>
<p><strong> </strong></p>
<div style="FLOAT: left"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "2144048671";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<p><strong><span style="text-decoration: underline;">The “sqrt” Function</span>:</strong></p>
<p><strong> </strong>It is used to calculate the square root of a given positive number. Its syntax is:<br />
<strong>sqrt (x);</strong></p>
<p>Where<br />
<strong>x :</strong> is the positive number of type double (or variable). It also returns a value of type double.<br />
<strong>Example:</strong> If <strong>x = 9.0</strong> then <strong>sqrt (x)</strong> returns <strong>3.0</strong></p>
<p><strong><span style="text-decoration: underline;">The “floor” Function</span>:</strong></p>
<p><strong> </strong>It is used to round a given float value to the integer value. The given float value is converted to the largest integer that is not greater than the given float value.<br />
Its syntax is: <strong>floor(x);</strong></p>
<p>Where<br />
<strong>x:</strong> is a float or double value / variable.<br />
<strong>Example:</strong> If <strong>x = 9.6</strong> then <strong>floor(x)</strong> returns <strong>9.0</strong>. If <strong>x= -9.6</strong> then <strong>floor(x)</strong> returns <strong>-10.0</strong>.</p>
<p><strong><span style="text-decoration: underline;">The “ceil” Function</span>:</strong></p>
<p><strong> </strong>It is similar to the “<strong>floor</strong>” function but it returns the rounded integer value greater than the given float or double number. Its syntax is: <strong>ceil (x);</strong></p>
<p>Where<br />
<strong>x :</strong> is the given float or double type given number or value.<br />
<strong>Example:</strong> If <strong>x </strong><strong>= 19.2</strong> then <strong>ceil(x)</strong> returns <strong>20.0.</strong> <strong>If x= -19.2</strong> then <strong>ceil(x)</strong> returns <strong>-19.0</strong>.</p>
<p><strong><span style="text-decoration: underline;">The “fmod” Function</span>:</strong></p>
<p><strong> </strong>It is used to calculate the remainder by dividing one floating number by another floating number. Its syntax is: <strong>fmod (x ,y);</strong><br />
<strong>x :</strong> represent the nominator. It is a floating number or variable.<br />
<strong>y :</strong> represent the denominator. It is a floating number or variable.<br />
<strong>Example:</strong> If <strong>x = 9.50</strong> and <strong>y =  4.00</strong> then <strong>fmod(x, y)</strong> returns <strong>1.5</strong>. When <strong>y = 0</strong>, <strong>fmod</strong> returns <strong>0</strong>.</p>
<p><strong><span style="text-decoration: underline;">The “cos” Function</span>:</strong></p>
<p><strong> </strong>It is used to calculate the trigonometric cosine of a given angle. The angle is given in radians as a floating number. Its syntax is: <strong>cos (x); </strong></p>
<p>Where:<br />
<strong>x :</strong> represents an angle in radians.<br />
<strong>Example:</strong> If <strong>x = 0.0</strong> then <strong>cos (x)</strong> returns <strong>1.0</strong>.</p>
<p><strong><span style="text-decoration: underline;">The “sin” Function</span>:</strong></p>
<p><strong> </strong>It is used to calculate the trigonometric sine of a given floating number. The angle is given in radians as a floating number. Its syntax is: <strong>sin (x)</strong></p>
<p>Where:<br />
<strong>x :</strong> represents an angle or value in radians.<br />
<strong>Example:</strong> if <strong>x </strong><strong>= 0.0</strong> then <strong>sin (x)</strong> returns <strong>0</strong>.</p>
<p><strong><span style="text-decoration: underline;">The “tan” Functions</span>:</strong></p>
<p><strong> </strong>It is used to calculate the trigonometric tangent of given floating number. The angle is given in radians as a floating number. Its syntax is: <strong>tan (x);</strong></p>
<p>Where<br />
<strong>x :</strong> represents an angle or value in radians<br />
<strong>Example:</strong> If <strong>x = 0.0</strong> then <strong>tan (x)</strong> returns <strong>0</strong>.</p>
<p><strong><span style="text-decoration: underline;">The “log” Function</span>:</strong></p>
<p><strong> </strong>It is used to calculate the natural logarithm (base e) or a given floating number. Its syntax is: <strong>log (x);</strong></p>
<p>Where<br />
<strong>x :</strong> represents a given floating number.</p>
<p><strong><span style="text-decoration: underline;">The “log10” Function</span>:</strong></p>
<p><strong> </strong>It is used to calculate the logarithm (base 10) of a given floating number. Its syntax is: <strong>log10(x);</strong></p>
<p>Where<br />
<strong>x :</strong> represents a given floating number.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/built-in-function-of-math/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Built-In Function of String</title>
		<link>http://www.info-village.info/built-in-function-of-string/</link>
		<comments>http://www.info-village.info/built-in-function-of-string/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 17:22:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/?p=739</guid>
		<description><![CDATA[Built-In Functions of String:
 The “string.h” header file contains the functions that are used to process strings. The commonly used functions of this header file are given below.
The “strlen” Function:
 The “strlen” stands for string length. This function is used to find the length of a string. It counts the total number of characters including [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Built-In Functions of String</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>string.h</strong>” header file contains the functions that are used to process strings. The commonly used functions of this header file are given below.</p>
<p><strong><span style="text-decoration: underline;">The “strlen” Function</span>:</strong></p>
<p><strong> </strong>The “<strong>strlen</strong>” stands for string length. This function is used to find the length of a string. It counts the total number of characters including spaces. Null character is excluded.<br />
Its syntax is:<br />
<strong>int strlen (string);</strong></p>
<p><strong> </strong></p>
<p style="text-align: justify;">Where <strong>string</strong> represents the string whose number of characters are to be counted. It may he a constant string or a string type variable. It returns integer type value.</p>
<div style="FLOAT: left"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "2144048671";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<p><strong><span style="text-decoration: underline;">The “strcmp” Function</span>:</strong></p>
<p><strong> </strong>The “<strong>strcmp</strong>” stands for string compare. This function is used to compare two strings. It compares first string with the second string character by character.<br />
Its syntax is:</p>
<p>int strcmp(stringl, string2);</p>
<p>Where<br />
<strong>string 1:</strong> represents the first string. It may be a string constant or a string type variable.<br />
<strong>string 2:</strong> represents the second string. It may be a string constant or string type variable.</p>
<p><strong><span style="text-decoration: underline;">The “strnemp” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>This function is similar to the “<strong>strnemp</strong>” function but it compares the specified number of characters of the two strings.<br />
Its syntax is:<br />
<strong>int strnemp(string 1, string 2, n);</strong></p>
<p><strong> </strong></p>
<p>Where</p>
<p><strong>String 1</strong> represents the first string. It may be a string constant or a string type variable.<br />
<strong>String 2</strong> represents the second string. It may be a string constant or a string type variable.<br />
n represents a specified number of characters that are to be compared. It may he an integer constant or integer type variable.</p>
<p><strong><span style="text-decoration: underline;">The “strcpy” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>strcpy</strong>” stands for string copy. It is used to copy the contents of one string to another string variable including the null character (‘\0’).<br />
Its syntax is:</p>
<p><strong>Strcpy (string l, string 2);</strong></p>
<p style="text-align: justify;">Where<br />
<strong>String 1</strong> represents the first string, it must be a string type variable because the contents of string 2 are to be copied into it.<br />
<strong>String 2</strong> represents the second string. It may be a string constant or string type variable.<br />
For example, to Copy the string “I love my School” into the string variable “sch”, the statement is written as:<br />
<strong>strcpy (sch, “I love my School”);</strong></p>
<p><strong><span style="text-decoration: underline;">The “strncpy” Function</span>:</strong></p>
<p><strong> </strong>It is similar to “<strong>strcpy</strong>” function but it is used to copy a specified number of characters from one string to another string variable.<br />
Its syntax is:</p>
<p><strong>strncpy (string 1, string 2, n);</strong></p>
<p><strong> </strong></p>
<p style="text-align: justify;">Where<br />
<strong>String 1</strong> represents the first string. It must be a string type variable because the first “n” characters of string2 are to be copied into it.<br />
<strong>String 2</strong> represents the second string. It may be a string constant or a string type variable. The first “n” characters of this string are copied into the string 1, represents the number of characters of string2 that are to be copied into string 1. It may be an integer constant or an integer type variable.</p>
<p><strong><span style="text-decoration: underline;">The “strcat” Function</span>:</strong></p>
<p><strong> </strong>The “<strong>strcat</strong>” stands for string concatenate. It is used to append or combine the contents of one string to another string variable including the null character. Its syntax is:</p>
<p><strong>strcat (string 1 , string 2);</strong></p>
<p><strong> </strong></p>
<p style="text-align: justify;">Where<br />
<strong>string 1</strong> represents the first string. It must be a string type variable because the contents of string2 are to be added at the end of this string.<br />
<strong>string 2</strong> represents the second string. It may be a string constant or a string type variable. The contents of this string are added at the end of the string 1.</p>
<p><strong><span style="text-decoration: underline;">The “strncat” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>It is similar to “<strong>strcat</strong>” function hut it is used to append a specified number of characters of one string to another string variable. Its syntax is:</p>
<p><strong>strncat (string l, string2, n);</strong></p>
<p><strong> </strong></p>
<p>Where</p>
<p style="text-align: justify;"><strong>String 1</strong> represents the first string. It must be a string type variable because the specified number of characters of string2 is appended at the end of this string.<br />
<strong>String 2</strong> represents the second string. It may be a string constant or a string type variable. The specified characters of this string are appended at the end of siring 1 represents the number of characters of string 2 that have to be appended at the end of string 1. It may he an integer value or an integer type variable.</p>
<p style="text-align: justify;"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/built-in-function-of-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Standard Input and Output Functions C++</title>
		<link>http://www.info-village.info/standard-input-and-output-functions-cpp/</link>
		<comments>http://www.info-village.info/standard-input-and-output-functions-cpp/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 13:34:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/?p=734</guid>
		<description><![CDATA[Standard Input and Output Functions C++:
 The “stdio” stands for standard input/output. This header file contains a large number of standard Input and Output functions that are used to get input from tile input devices and also to print results on output devices.
The commonly used functions of this header file and their description is given [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Standard Input and Output Functions C++</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>stdio</strong>” stands for standard input/output. This header file contains a large number of standard <strong>Input and Output functions</strong> that are used to get input from tile input devices and also to print results on output devices.<br />
The commonly used functions of this header file and their description is given below.</p>
<div style="FLOAT: left"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "2144048671";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<p><strong><span style="text-decoration: underline;">The “getchar” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>This function is similar to “<strong>getch</strong>” &amp; “<strong>getche</strong>” functions of “<strong>conio.h</strong>” header file, It is also used to get a single character from a standard input device, i.e. from tile keyboard during program execution. The main features of this function are:<br />
• When a character is entered, it is displayed on the screen.<br />
• Enter key must be pressed to complete the input.<br />
Its syntax is:<br />
<strong>[var = ] getchar ( );</strong></p>
<p style="text-align: justify;">The use of [var = ] is optional. It is used to store the value of the character entered from the keyboard.<strong> </strong></p>
<p><strong> </strong></p>
<p><strong><span style="text-decoration: underline;">The “putchar” Function</span>:</strong></p>
<p><strong> </strong>The “<strong>putchar</strong>” stands for put character.<br />
It is used to put or print a single character on the standard output device. i.e. the computer screen.</p>
<p><strong><span style="text-decoration: underline;">The “gets” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>This function is used to get (input) data into a string variable from the keyboard. Any type of characters including space &amp; special characters can he entered using this function. Enter key is pressed after entering the string. When Enter key is pressed a null character is appended at the end of the string.<br />
Its syntax is:</p>
<p><strong>gets (strvar);</strong></p>
<p><strong> </strong></p>
<p>where<br />
<strong>strvar</strong> represents the string type variable into which data is to be entered.</p>
<p style="text-align: justify;">The data in a string type variable can also be entered by using “cin” object but this object is not the most suitable method of inputting data into string variables. When a space key is pressed during input process, the “cin” object immediately appends the null character (‘\O’) at that, place in the string. The characters entered after the spaces are not stored in the string variable.</p>
<p><strong><span style="text-decoration: underline;">The “put” Function</span>:</strong></p>
<p><strong> </strong>It is used to print a string on the computer screen. The new line is inserted after printing the string.<br />
Its syntax is:</p>
<p><strong>puts (string);</strong></p>
<p><strong> </strong></p>
<p style="text-align: justify;">The “<strong>string</strong>” may be a ring constant or string type variable.<br />
• In case of a string constant, the string is enclosed in double quotes.<br />
• In case of a string variable, it is written without using quotes.</p>
<p style="text-align: justify;"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/standard-input-and-output-functions-cpp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Common C++ Built-In Functions</title>
		<link>http://www.info-village.info/common-cpp-built-in-functions/</link>
		<comments>http://www.info-village.info/common-cpp-built-in-functions/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 13:05:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learn C++]]></category>

		<guid isPermaLink="false">http://www.info-village.info/?p=729</guid>
		<description><![CDATA[Common C++ Built-in Functions:
 The commonly used built-in functions are discussed below:
The “conio.h” Function:
 The “conio.h” stands for console input/output. This header file contains basic input &#38; output functions that are used to get data from the keyboard and to send results from the memory to the output screen. A brief description of commonly used [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline;">Common C++ Built-in Functions</span>:</strong></p>
<p><strong> </strong>The commonly used built-in functions are discussed below:</p>
<p><strong><span style="text-decoration: underline;">The “conio.h” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>conio.h</strong>” stands for console input/output. This header file contains basic input &amp; output functions that are used to get data from the keyboard and to send results from the memory to the output screen. A brief description of commonly used functions of this header file is given below.</p>
<div style="FLOAT: left"><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "2144048671";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<p><strong><span style="text-decoration: underline;">The “clrscr” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>clrscr</strong>” stands for clear screen. This function is used to clear the screen of the computer. When this function is executed, the screen is cleared and the cursor shifts to upper left corner, i.e. to row 1 and column 1 of the screen.<br />
Its syntax is: <strong>clrscr( );</strong></p>
<p><strong><span style="text-decoration: underline;">The “gotoxy” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>gotoxy</strong>” function shifts cursor on the screen to a specified location. This function is used when an output is to he printed on a specified location on the screen. Its syntax is: <strong>gotoxy(x, y);</strong><br />
Where<br />
<strong>x:</strong> the x co-ordinate (or column) on the screen. Its value may he from 0 to 79.<br />
<strong>y:</strong> the y co-ordinate (or row) on the screen. Its value may he from 0 to 24.</p>
<p><strong><span style="text-decoration: underline;">The “clreol” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>clreol</strong>” stands for clear end of line. This function is used to clear a single line from the current cursor position up to the end of line. The other text printed on the screen is not cleared.<br />
Its syntax is: <strong>clreol( );</strong></p>
<p><strong><span style="text-decoration: underline;">The “getch” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>getch</strong>” stands for get character. This function is used to get a single character from the keyboard during program execution. When a key is pressed:<br />
• The entered character is not displayed on the screen<br />
• Pressing of the Enter key is not required to complete the input. The control shills to the next statement as soon as any key is pressed.<br />
This function is normally used to pause the execution of program. Its syntax is:</p>
<p><strong>[var = ] getch( );</strong></p>
<p style="text-align: justify;">The use of [var = ] is optional. It is used to store the value of the character entered from the keyboard.</p>
<p><strong><span style="text-decoration: underline;">The “getche” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>This function is similar to “<strong>getch</strong>’. It is also used to get a single character from keyboard during the program execution. The main difference between “<strong>getch</strong>” and “<strong>getche</strong>” is that the entered character is displayed on the screen when “<strong>getch</strong>” function is used.<br />
Its syntax is: <strong>[var = ] getche ( );</strong></p>
<p style="text-align: justify;">The use of [var = ] is optional. It is used to store the value of the cha racier entered from the keyboard.</p>
<p><strong><span style="text-decoration: underline;">The “kbhit” Function</span>:</strong></p>
<p style="text-align: justify;"><strong> </strong>The “<strong>kbhit</strong>” stands for keyboard hit. This function checks the keyboard hit and returns a non-zero value when a key on the keyboard is hit during program execution. Otherwise it returns zero value.<br />
Its syntax is: <strong>[var = ] kbhit( );</strong></p>
<p style="text-align: justify;">The use of [var = ] is optional. It is used to store the value of the character entered from the keyboard.</p>
<p style="text-align: justify;">
<p><script type="text/javascript"><!--
google_ad_client = "pub-0259111404843010";
google_ad_slot = "6298138813";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.info-village.info/common-cpp-built-in-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
