<?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>Algorithms | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/algorithms/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sun, 11 Dec 2022 09:24:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ program to implement three classes using multiple inheritance</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 15:11:45 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[multiple inheritance]]></category>
		<category><![CDATA[implement three class]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[Algorithms]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1060</guid>

					<description><![CDATA[<p>MULTIPLE INHERITANCES AIM: Write a program to illustrating how all the three classes are implemented in multiple inheritance mode ALGORITHM • Start the process • Invoke the class M • Invoke the another class N • Invoke one more class,ie class P,which is inherited by both M and N • Create an object for class</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/">C++ program to implement three classes using multiple inheritance</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>MULTIPLE INHERITANCES</strong></p>
<p><strong>AIM:</strong><br />
Write a program to illustrating how all the three classes are implemented in multiple inheritance mode</p>
<p><strong>ALGORITHM</strong><br />
•	Start the process<br />
•	Invoke the class M<br />
•	Invoke the another class N<br />
•	Invoke one more class,ie class P,which is inherited by both M and N<br />
•	Create an object for class p,ie P p<br />
•	Call p.get_m(),assign the value in to ‘m’<br />
•	Call p.get_n(),assign the value in to ‘n’<br />
•	Call display(), for dispay the result<br />
•	Stop the result </p>
<p><strong>PROGRAM:</strong></p>
<pre lang="cpp">
	#include<iosteram.h>
	#include<conio.h>
	
	Class M
        {
		Protected:
		Int m;
		Public :
		Void get_M();
	};
	Class N
        {		
		Protected:
		Int n;
		Public:
		Void get_N();
	};
	Class p: public M, public N 		
	{
		Public:
		Void disply(void);
	};
	Void M ::get_m(int x)
	{
		m=x;
	}
	Void N::get_n(int y)
	{
		n=y;
	}
	Void P:: disply(void)
	{
	Cout<<”m=”<<m<<endl;
	Cout<<”n=”<<n<<endl;
	Cout<<”m*n=”<<m*n<<endl;
	}
	int main()
	{
		P p;
		p.get_m(10);
		p.get_n(20);
		p.display();
		return 0;
	}
</pre>
<p><strong>OUTPUT</strong></p>
<p>	m=10<br />
	n=20<br />
	m*n=200</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/">C++ program to implement three classes using multiple inheritance</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-three-classes-using-multiple-inheritance/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to print student details using constructor and destructor</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-print-student-details-using-constructor-and-destructor/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-print-student-details-using-constructor-and-destructor/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 12 Mar 2010 18:22:49 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c programs]]></category>
		<category><![CDATA[cpp class]]></category>
		<category><![CDATA[destructor]]></category>
		<category><![CDATA[constructor]]></category>
		<category><![CDATA[Algorithms]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1046</guid>

					<description><![CDATA[<p>AIM: A program to print student details using a constructor and destructor. ALGORITHM: PROGRAM Output:</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-print-student-details-using-constructor-and-destructor/">C++ program to print student details using constructor and destructor</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>AIM: </strong></p>



<p>A program to print student details using a constructor and destructor.</p>



<p><strong>ALGORITHM:</strong></p>



<ol>
<li>Start the process</li>



<li>Invoke the classes</li>



<li>Call the read() function
<ul>
<li>Get the inputs name, roll number and address</li>
</ul>
</li>



<li>Call the display() function
<ul>
<li>Display the name, roll number, and address of the student</li>
</ul>
</li>



<li>Stop the process</li>
</ol>



<p><strong>PROGRAM</strong></p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;iostream>
using namespace std;

class student
{
	private: char name[20],add[20];
	  	int roll,zip;
	public: student ( ); //Constructor
		~student( ); //Destructor
		void read( );
		void disp( );			
};

student :: student( )
{
	cout&lt;&lt;"Student class constructor called."&lt;&lt;endl;
}

void student :: read( )
{
	cout&lt;&lt;"Enter the student Name: ";
	cin>>name;
	cout&lt;&lt;"Enter the student roll no: “;
	cin>>roll;
	cout&lt;&lt;"Enter the student address: ";
	cin>>add;
	cout&lt;&lt;"Enter the Zipcode: ";
	cin>>zip;
}

void student :: disp( )
{
	cout&lt;&lt;"Studet details"&lt;&lt;endl;
	cout&lt;&lt;"Student Name   :"&lt;&lt;name&lt;&lt;endl;
	cout&lt;&lt;"Roll no is     :"&lt;&lt;roll&lt;&lt;endl;
	cout&lt;&lt;"Address is     :"&lt;&lt;add&lt;&lt;endl;
	cout&lt;&lt;"Zipcode is     :"&lt;&lt;zip&lt;&lt;endl;
}

student :: ~student( )
{
	cout&lt;&lt;"Student class destructor called.";
}
 
int main( )
{
	student s;
	s.read();
	s.disp();
}</code></pre>



<p><strong>Output:</strong></p>



<pre class="wp-block-code"><code lang="" class="">Student class constructor called.

Enter the student Name: Rajesh
Enter the student roll no: 1234
Enter the student address: Bangalore
Enter the Zipcode: 560001

Studet details
Student Name   :Rajesh
Roll no is     :1234
Address is     :Bangalore
Zipcode is     :560001

Student class destructor called.</code></pre>



<p></p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-print-student-details-using-constructor-and-destructor/">C++ program to print student details using constructor and destructor</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-print-student-details-using-constructor-and-destructor/feed/</wfw:commentRss>
			<slash:comments>34</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program for implementation of class</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 12 Mar 2010 09:45:07 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[class implementations]]></category>
		<category><![CDATA[c++ class]]></category>
		<category><![CDATA[C++ Programs]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Source Codes]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1044</guid>

					<description><![CDATA[<p>AIM: A program to solve a quadratic equation, using OOP techniques. ALGORITHM: 1) Start the process 2) Invoke the classes 3) Get the input for a,b,c; 4) Call the function getinfo() and display() 5) Check if a=0 a) True : compute c/b; i) Print the value of a/c; b) False: compute b*b-4*a*c; i) If (</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/">C++ program for implementation of class</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>AIM: 	</strong><br />
	A program to solve a quadratic equation, using OOP techniques.</p>
<p><strong>ALGORITHM: </strong></p>
<p>1)	Start the process<br />
2)	Invoke the classes<br />
3)	Get the input for a,b,c;<br />
4)	Call the function getinfo() and display()<br />
5)	Check if a=0<br />
a)	True : compute c/b;<br />
i)	Print the value of a/c;<br />
b)	False: compute b*b-4*a*c;<br />
i)	If ( b*b-4*a*c)=0<br />
ii)	Call img();<br />
iii)	Otherwise : call real(a,b,c);<br />
6)	Stop the process</p>
<p><strong>PROGRAM:</strong></p>
<pre lang="cpp">
	#include<iostream.h>
	#include<conio.h>
		class equation
		{
			private:float a,b,c;
			public: void getinfo(float  a, float b,float c );
				void display( );
				void equal(float  a, float b);
				void imag( );
				void real(float a,float b,float c);
		};
		void  equation :: getinfo(float aa,float bb,float cc)
		{
	                a=aa;
			b=bb;
		        c=cc;
		}
		void equation::display( )
		{
			cout<<endl;
			cout<<”a=”<<a<<’\t’;
			cout<<”b=”<<b<<’\t’;
			cout<<”c=”<<c<<endl;
		}		

void equation ::equal (float a,float b)
		{
			float x;
			x = -b/(2*a);
			cout<<”Roots are equal “<<x<<endl;
		}
		void equation :: imag( )
		{
			cout<<”Roots are imaginary”;
		}
		void equation :: real(float a,float b,float det)
		{
			float x1,x2,temp;
			temp = sqrt(det);
			x1= (-b + temp)/(2*a);
			x2 = (-b –temp)/(2*a);
			cout<<”Roots are real”;
			cout<<”x1= “<<x1<<endl;
			cout<<”x2 =”<<x2<<endl;
		}
		void main( )
		{
			class equation e;
			float aa,bb,cc;
			clrscr( );
			cout<<”Enter the three numbers”;
			cin>>aa>>bb>>cc;
			e.getinfo(aa,bb,cc);
			e.display( );
			if(aa = =0)
			{
				float temp;
				temp = cc/bb;
				cout<<” Linear Roots”<<temp<<endl;
			}
			else
			{
				float det;
				det = (bb*bb – 4*aa*cc);
				if(det = =0)
				e.equal(aa,bb);
				else if (det<0 )
				          e.imag( );
				else 
				          e.real(aa,bb,cc );
			}
			getch( );
		}	
</pre>
<p><strong>OUTPUT:</strong><br />
	Enter the three numbers 2 4 1<br />
	Roots are imaginary<br />
	X1= - 0.292893<br />
	X2= - 1.707107</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/">C++ program for implementation of class</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-for-implementation-of-class/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lexical Analyzer</title>
		<link>https://studentprojects.in/software-development/software-projects/software/lexical-analyzer/</link>
					<comments>https://studentprojects.in/software-development/software-projects/software/lexical-analyzer/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 20 Nov 2008 07:37:32 +0000</pubDate>
				<category><![CDATA[Software Engineering Projects]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[C codes]]></category>
		<category><![CDATA[characters to tokens]]></category>
		<category><![CDATA[Lexical Analyzer]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=223</guid>

					<description><![CDATA[<p>Lexical analyzer converts stream of input characters into a stream of tokens. The different tokens that our lexical analyzer identifies are as follows: KEYWORDS: int, char, float, double, if, for, while, else, switch, struct, printf, scanf, case, break, return, typedef, void IDENTIFIERS: main, fopen, getch etc NUMBERS: positive and negative integers, positive and negative floating</p>
<p>The post <a href="https://studentprojects.in/software-development/software-projects/software/lexical-analyzer/">Lexical Analyzer</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Lexical analyzer converts stream of input characters into a stream of tokens. The different tokens that our lexical analyzer identifies are as follows:</p>
<p>KEYWORDS: int, char, float, double, if, for, while, else, switch, struct, printf, scanf, case, break, return, typedef, void</p>
<p>IDENTIFIERS: main, fopen, getch etc</p>
<p>NUMBERS: positive and negative integers, positive and negative floating point numbers.</p>
<p>OPERATORS: +, ++, -, &#8211;, ||, *, ?, /, &gt;, &gt;=, &lt;, &lt;=, =, ==, &amp;, &amp;&amp;.</p>
<p>BRACKETS: [ ], { }, ( ).</p>
<p>STRINGS : Set of characters enclosed within the quotes</p>
<p>COMMENT LINES: Ignores single  line, multi line comments</p>
<p>For tokenizing into identifiers and keywords we incorporate a symbol table which initially consists of predefined keywords. The tokens are read from an input file. If the encountered token is an identifier or a keyword the lexical analyzer will look up in the symbol table to check  the existence  of the respective token. If an entry does exist then we proceed to the next  token. If not then that particular  token along with the token value is written into the symbol table. The rest of the tokens are directly displayed by writing into an output file.</p>
<p>The output file will consist of all the tokens present in our input file along with their respective token values.</p>
<p><strong>INTRODUCTION:</strong></p>
<p>Lexical analysis involves scanning the program to be compiled and recognizing the tokens that make up the source statements Scanners or lexical analyzers are usually designed to recognize keywords , operators , and identifiers , as well as integers, floating point numbers , character strings , and other  similar items that are written as part of the source program . The exact set of  tokens to be recognized of course, depends upon the programming language being used to describe it.</p>
<p>A sequence of input characters that comprises a single token is called a lexeme. A lexical analyzer can insulate a parser from the lexeme representation of tokens. Following are the list of functions that lexical analyzers perform.</p>
<p><strong>Removal of white space and  comment :</strong></p>
<p>Many languages allow “white space” to appear between tokens. Comments can likewise be ignored by the parser and translator , so they may also be treated as white space. If white space is eliminated by the lexical analyzer, the parser will never have to consider it.</p>
<p><strong>Constants :</strong></p>
<p>An integer constant is a sequence of digits, integer constants can be allowed by adding productions to the grammar for expressions, or by creating a token for such constants . The job of collecting digits into integers is generally given to a lexical analyzer because numbers can be treated as single units during translation. The lexical analyzer passes both the token and attribute to the parser.<br />
<strong><br />
Recognizing identifiers and keywords :</strong></p>
<p>Languages use identifiers as names of variables, arrays and functions. A grammar for a language often treats an identifier as a token. Many languages use fixed character strings such as begin, end , if, and so on, as punctuation marks or to identify certain constructs. These character strings, called keywords, generally satisfy the rules for forming identifiers.</p>
<p><strong>SYSTEM ANALYSIS:</strong></p>
<p>The operating  system used is MS-DOS.</p>
<p><strong>MS-DOS : </strong>The MS-DOS is a single user, single process, single processor operating system. Due to the confinement of the device dependent code into one layer, the porting of MS-DOS has theoretically been reduced to writing  of the BIOS code for the new hardware. At the command level it provides a hierarchical file system, input output redirection, pipes and filters. User written commands can be invoked in the same way as the standard system commands, giving the appearance as if the basic system functionality has been extended.</p>
<p>Being a single user system, it provides only file protection and access control. The disk space is allocated in terms of a cluster of consecutive sectors. The command language of MS-DOS has been designed to allow the user to interact directly with the operating system using a CRT terminal. The principal use of the command language is to initiate the execution of commands and programs. A user program can be executed under MS-DOS by simply typing the name of the executable file of the user program at the DOS command prompt.</p>
<p>The programming language used here is C programming</p>
<p><strong>SYSTEM DESIGN:</strong></p>
<p><strong>Process:</strong></p>
<p>The lexical analyzer is the first phase of  a compiler. Its main task is to read the input characters and produce as output a sequence of tokens that the parser uses for syntax analysis. This interaction, summarized schematically in fig. a.</p>
<p><figure id="attachment_224" aria-describedby="caption-attachment-224" style="width: 486px" class="wp-caption aligncenter"><img decoding="async" class="size-full wp-image-224" title="fig a. Process of lexical analyzer " src="https://studentprojects.in/wp-content/uploads/2008/11/block_1.gif" alt="fig a. Process of lexical analyzer " width="486" height="179" /><figcaption id="caption-attachment-224" class="wp-caption-text">fig a. Process of lexical analyzer </figcaption></figure></p>
<p>Upon receiving a “get next token “command from the parser, the lexical analyzer reads the input characters until it can identify next token.</p>
<p>Sometimes , lexical analyzers are divided into a cascade of two phases, the first called “scanning”, and the second “lexical analysis”.</p>
<p>The scanner is responsible for doing simple tasks, while the lexical analyzer proper does the more complex operations.</p>
<p>The lexical analyzer which we have designed takes the input  from a input file. It reads one character at a time from the input file, and continues to read until end of the file is reached. It recognizes the valid identifiers, keywords and specifies the token values of the keywords.</p>
<p>It also identifies the header files, #define statements, numbers, special characters, various relational and logical operators, ignores the white spaces and comments. It prints the output in a separate file specifying the line number .</p>
<p><strong>BLOCK DIAGRAM:</strong></p>
<p><figure id="attachment_225" aria-describedby="caption-attachment-225" style="width: 450px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="size-full wp-image-225" title="fig b. Block diagram of the project" src="https://studentprojects.in/wp-content/uploads/2008/11/block_2.gif" alt="fig b. Block diagram of the project" width="450" height="198" /><figcaption id="caption-attachment-225" class="wp-caption-text">fig b. Block diagram of the project</figcaption></figure></p><p>The post <a href="https://studentprojects.in/software-development/software-projects/software/lexical-analyzer/">Lexical Analyzer</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/software-projects/software/lexical-analyzer/feed/</wfw:commentRss>
			<slash:comments>27</slash:comments>
		
		
			</item>
	</channel>
</rss>
