Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

DSU Micro Project

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

GOVERNMENT POLYTECHNIC,

GADCHIROLI

Branch Name: CO3I Computer Engineering

Subject: Data Structure Using ‘C’

Topic Name: Develop a Project to convert the arithmetic


expression into prefix, postfix, and infix.

Group No. 02

Presented by: Roll No.

Saniya S. Puchalwar 13

Vrushali S. Bujade 07

Chetana P. Nikode 06

Lokesh Atram 14

Guidance's By: Ms. Swati Nandeshwar Mam

PTO
Maharashtra State Board of Technical Education
Certificate
This is to certify that Mr./Ms. SANIYA SANTOSH PUCHALWAR. Roll
No. 13 of third /fourth-semester Diploma in COMPUTER ENGINEERING has
completed the micro-project satisfactorily in DATA STRUCTURE USING ‘C’
(22317) for the academic year 2021 To 2022. As prescribed in the MSBTE
curriculum.

Place: Gadchiroli Enrollment No: 2001190070

Date: 04/01/2022 Exam Seat No.

Subject Teacher Head OF Department Principal

PTO
Maharashtra State Board of Technical Education
Certificate
This is to certify that Ms./Mr. VRUSHALI S. BUJADE. Roll No. 07 of
third /fourth-semester Diploma in COMPUTER ENGINEERING has
completed the micro-project satisfactorily in DATA STRUCTURE USING ‘C’
(22317) curriculum.

Place: Gadchiroli Enrollment No: 2001190068

Date: 04/01/2022 Exam Seat No.

Subject Teacher Head OF Department Principal

Seal of Institution

PTO
Maharashtra State Board of Technical Education
Certificate
This is to certify that Mr./Ms. CHETANA P. NIKODE. Roll No. 06 of
third /fourth-semester Diploma in COMPUTER ENGINEERING has
completed the micro-project satisfactorily in DATA STRUCTURE USING ‘C’
(22317) for the academic year 2021 To 2022. As prescribed in the MSBTE
curriculum.

Place: Gadchiroli Enrollment No: 2001190067

Date: 04/01/2022 Exam Seat No.

Subject Teacher Head OF Department Principal

PTO
Maharashtra State Board of Technical Education
Certificate
This is to certify that Mr./Ms. LOKESH KISHOR ATRAM. Roll No. 14 of
third /fourth-semester Diploma in COMPUTER ENGINEERING has
completed the micro-project satisfactorily in DATA STRUCTURE USING ‘C’
(22317) curriculum.

Place: Gadchiroli Enrollment No: 2001190069

Date: 04/01/2022 Exam Seat No.

Subject Teacher Head OF Department Principal

Seal of Institution

PTO
A
PROJECT REPORT
ON
“DEVELOP A PROJECT TO CONVERT ARITHMETIC EXPRESSION INTO PREFIX,
POSTFIX, AND INFIX.”

A PROJECT SUBMISSION TO

GOVERNMENT POLYTECHNIC GADCHIROLI

2018-2019
In Partial Fulfillment of Requirement for the

Award of

“Science and Humanities Department”


SUBMITTED BY

1. Saniya S. Puchalwar
2. Vrushali S. Bujade
3. Chetana P. Nikode
4. Lokesh Atram

GUIDED BY
Prof. Ms. Swati Nandeshwar Mam
DEPARTMENT OF SCIENCE & HUMANITIES.

PTO
SUBMISSION
We are the students of the second year of the course Diploma in Computer
Engineering humbly submitted that we have completed project work“Develop a
Project to Convert Arithmetic Expression into Prefix, Postfix and Infix” as
described in this report by our skills and study between the period 2021-2022 as
per the guidance of prof. MS. Swati Nandeshwar and that the following students
were associated with this work. However, the teacher has approved the quantum
of contribution.

We further declare that we have not copied the report per this any
appreciable part from any other literature in contravention of the academic
session

SUBMITTED BY

1. Saniya S. Puchalwar
2. Vrushali S. Bujade
3. Chetana P. Nikode
4. Lokesh K. Atram

DATE: – 04/01/2022 SCIENCE AND HUMANITIES


PLACE: - Gadchiroli GOVERNMENT POLYTECHNIC, GADCHIROLI

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MUMBAI

PTO
Part – A Micro-Project Proposal Annexure-I
Develop a Project to Convert Arithmetic Expression into
Prefix, Postfix, and Infix

1.0 Aim/Benefits of the Micro-Project (minimum 30-50 words) The aim of the project is to
know more about how to manage student data. The student management system aims to make
simpler college/school staff’s interactions with students. Make functioning faster for finding
data of any student. Reduce space consumed and less time required. Paperwork is reduced.
Fewer efforts are taken.

2.3 Course Outcomes Addressed


a) In this project, we covered the following course outcomes:
b) File handling functions in C.
c) Concept of Classes and Objects.

3.0 Proposed Methodology (produce in brief that will be followed to the micro-project about
100 to 200 words.)
➢ First, we will discuss the topics and then select the topic.
➢ All group members collect the data related to the topic from different sources.
➢ All group members give their ideas for completing the project.
➢ Then last we will start working on the project.

4.0 Action Plan (Sequence and time required for major activity)

S. Details of activity Planned Start Planned Name of Responsible


No. date Finish date Team Members

1 Collecting data 01/01/2022 01/01/2022 Saniya Puchalwar

2 Discussion on 01/01/2022 01/01/2022 Saniya Puchalwar


project/discussion with the
guide

3 Working on a project and 02/01/2022 02/01/2022 Saniya Puchalwar


finalizing the project

4 Working on draft (typing, 03/01/2022 03/01/2022 Saniya Puchalwar


prints, etc.)

PTO
6.0 Resources Required (major resources such as raw material, some machine facility, software,
etc.)

Sr. No. Name of Resources/material Specifications Qty Remarks

1 Computer System Window 10 1

2 Software Dev C++ 1

● Names of Team Members with Roll No.

1. Saniya S. Puchalwar
2. Vrushali S. Bujade
3. Chetana P. Nikode
4. Lokesh K. Atram

******************************

PTO
Annexure-II

Part – B Micro-Project Report

Develop a Project to Convert Arithmetic Expression into


Prefix, Postfix, and Infix

1.0 Rational (Importance of the project, in about 30 to 50 words. This is a modified version of
the earlier one written after the work.)

In this project, users can perform general student management operations related to students
like adding new students, the student login, faculty login, proctor login, admin view, etc. In
student management system projects in C++, file handling is used to perform various functions
like adding students, etc.

We can find student data very easily with the help of this program. It consumes/saves our time.
We can arrange student data as per their branch or department. We separate and find students,
their batch, and various information about them very easily.

2.0 Aims/Benefits of the Micro-Project

The aim of the project is to know more about how to manage student data. The student
management system aims to make simpler a college/school staffs interaction with students.
Make functioning faster for finding data of any student. Reduce space consumed and less time
required. Paperwork is reduced. Fewer efforts are taken.

3.0 Course Outcomes Addressed (Add to the earlier list if more course addressed)

a) In this project we covered the following course outcomes:


b) File handling functions in C++.
c) Concept of classes and objects

4.0 Literature Review

PTO
Definition of Infix, Postfix, and Prefix
Infix: The typical mathematical form of expression that we encounter generally is known
as infix notation. In infix form, an operator is written in between two operands.

For example:

An expression in the form of A * ( B + C ) / D is in infix form. This expression can be


simply decoded as: “Add B and C, then multiply the result by A, and then divide it by D
for the final answer.”

Prefix: In prefix expression, an operator is written before its operands. This notation is
also known as “Polish notation”.

For example, The above expression can be written in the prefix form as / * A + B C D.
This type of expression cannot be simply decoded as infix expressions.

Postfix: In postfix expression, an operator is written after its operands. This notation is
also known as “Reverse Polish notation”.

For example, The above expression can be written in the postfix form as A B C + * D /.
This type of expression cannot be simply decoded as infix expressions.

Refer to the table below to understand these expressions with some examples:

Infix Prefix Postfix

A+B +AB AB+

A+B-C -+ABC AB+C-

(A+B)*C-D -*+ABCD AB+C*D-

Prefix and postfix notions are methods of writing mathematical expressions without
parentheses. Let’s see the infix, postfix and prefix conversion.

PTO
Prefix to Postfix Conversion
Converting a prefix expression to a postfix expression is almost the same as the above
conversions. The one difference is that we’ll use stack to store operands this time.

Algorithm:

● Reverse the prefix string.


● Create a stack.
● For each character c in the input stream:

If c is an operand

Push it in the stack

Else

{ // c is an operator

Pop two tokens(operand) from the stack. Concatenate the operands and the
operator, as (operand 1 + operand 2 + operator). And push this string back in
the stack

Note: This string will now act as an operand.

● Repeat until the stack is empty or the input string ends.

For a better understanding, let’s trace out an example: * + A B – C D

Reversed String: D C – B A + *

Input Character Operation on Stack Stack-1(Postfix)

PTO
D Push D

C Push DC

– Concatenate and Push (CD-)

B Push (CD-) B

A Push (CD-) B A

+ Concatenate and Push (CD-) (AB+)

* Concatenate and Push (AB+) (CD-) *

End Final Output: AB+CD-*

Note: parentheses are only used to represent the string after concatenation.

Implementation of the above algorithm:

#include <bits/stdc++.h>

using namespace std;

// To check if character is operator or not

bool check_op(char x)

if(x =='+'|| x== '-'|| x== '/'|| x=='*')

return true;

else

return false;

PTO
// Convert prefix to Postfix expression

string prefixToPostfix(string str)

reverse(str.begin(), str.end());

stack<string> s;

int length = str.size();

for (int i = 0; i <length; i++)

if (check_op(str[i]))

string op1 = s.top();

s.pop();

string op2 = s.top();

s.pop();

string temp = op1 + op2 + str[i];

s.push(temp);

else

PTO
s.push(string(1, str[i]));

return s.top();

// Driver Code

int main()

string str1 = "*+AB-CD";

string str = prefixToPostfix(str1);

cout<<"The postfix string is: "<<str<<endl;

return 0;

Output:

The postfix string is: AB+CD-*

PTO
Infix to Postfix Conversion
In infix expressions, the operator precedence is implicit unless we use
parentheses. Therefore, we must define the operator precedence inside the
algorithm for the infix to postfix conversion.

Points to consider:

● The order of the numbers or operands remains unchanged. But the order of
the operators gets changed in the conversion.
● Stacks are used for converting an infix expression to a postfix expression.
The stack that we use in the algorithm will change the order of operators
from infix to Postfix.
● Postfix expressions do not contain parentheses.

Algorithm:

● Create a stack.
● For each character c in the input stream:

If c is an operand
{
Output c
}
Else if c is a right parentheses
{
Pop and output tokens until a left parentheses is popped
}
Else
{ // c is an operator or left parentheses
Pop and output tokens until one of the lower priorities than c
are encountered, or a left parentheses is encountered, or the stack is empty.
Push c
}

● Pop and output tokens until the stack is empty.

For a better understanding, let’s trace out an example: A * B- (C + D) + E

PTO
Input Operation on Stack Stack Postfix
Character Expression

A Empt A
y

* Push * A

B * AB

– Check and Push – AB*

( Push -( AB*

C -( AB*C

+ Check and Push -(+ AB*C

D AB*CD

) Pop and Append to Postfix – AB*CD+


till ‘(‘

+ Check and Push + AB*CD+-

E + AB*CD+-E

End Pop till empty AB*CD+-E+


Implementation of the above algorithm:

#include<bits/stdc++.h>
using namespace std;

//precedence of operators
int precedence(char ch)
{
if(ch == '^')
return 3;
else if(ch == '/' || ch =='*')
return 2;
else if(ch == '+' || ch == '-')
return 1;
else
return -1;
}

string infixToPostfix(string s)

PTO
{
stack<char> st;
string postfix_exp;

for(int i = 0; i < s.length(); i++)


{
char ch = s[i];

// If the input character is


an operand, add it to the postfix output string.
if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch
<= '9'))
postfix_exp += ch;

// If the input character is an


'(', push it to the stack.
else if(ch == '(')
st.push('(');

// If the input character is an ')',


pop and output string from the stack
until an '(' is encountered.
else if(ch == ')') {
while(st.top() != '(')
{
postfix_exp += st.top();
st.pop();
}
st.pop();
}

//If the character is an operator


else
{
while(!st.empty() && precedence(s[i]) <= precedence(st.top()))
{
postfix_exp += st.top();
st.pop();
}
st.push(ch);
}
}

// Pop all the remaining elements from the stack


while(!st.empty())
{
postfix_exp += st.top();
st.pop();

PTO
}

return postfix_exp;
}

int main()
{
string infix_expression = "A*B-(C+D)+E";
cout<<"The postfix string is: "<<infixToPostfix(infix_expression);
return 0;
}

Output:

The postfix string is: AB*CD+-E+

PTO
5.0 Actual Methodology Followed

It contains collecting data from the internet and references from books, our teacher’s
guidelines, and also refer from old project data.

To make this project our group discussion plays an important role. First, we will all discuss the
topics and select one topic. Then we will discuss the topic and start working.

➢ We collect all the information and raw materials which is significant for the project
completion.
➢ To collect the data related to the project we visit the internet café and for a book
reference, we will go to the library.
➢ We collect the data and start working on the project with the help of all the group
members.

6.0 Actual Resources Used (Mention the actual resource used)

Sr. Name of Resources/material Specification Qty Remarks


No.

1 Computer System Window 10 1

2 Software Dev C++ 1

3 Books Data Structure Using C 1

7.0 Outputs of the Micro project

❖ We successfully develop a student management system.


❖ We attach the output above.
❖ Furthermore, we learn about features of data structure using c.

8.0 Skill Developed/ Learning outcomes of this Micro project

The research methodology helps to learn how to use programming applications and software. It
develops special interests and skills. It helps to learn how to create a program code to manage
various types of data. Furthermore, it helps to understand the special needs of the research
process. It improves our creativity and thinking, we will be able to create various programs for
managing various types of data. Not only that, but it increases our level of concentration.

PTO

You might also like