DSU Project

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Shri Shamrao Patil (Yadravkar) Educational & Charitable Trust’s

SHARAD INSTITUTE OF TECHNOLOGY,


POLYTECHNIC.

DEPARTMENT OF COMPUTER ENGINEERING

MICRO PROJECT REPORT


ON

Reverse a String and a Number Using


Stack
FOR
S.Y. – 2020-21
Shri Shamrao Patil (Yadravkar) Educational & Charitable Trust’s
SHARAD INSTITUTE OF TECHNOLOGY,
POLYTECHNIC.

CERTIFICATE

This to certify that Mr./Ms. Aishwarya Mahesh Shivanagi from Sharad

Institute Of Technology Polytechnic, Yadrav institute having Enrollment No :

1909680251 has completed micro project of having title ‘REVERSE A

STRING AND A NUMBER USING STACK‘ during academic year 2020-

2021. The project completed by individually/in group consisting of 3 persons

under the guidance of Faculty Guide.

Name & Signature of Guide : Mr. R. M. Patil.


ACKNOWLEDGEMENT

It is my great pleasure to present the honour and sincere gratitude to my


guide Mr. R. M. Patil, Lecturer, Dept. of Computer Engineering, Sharad
Institute of Technology, Polytechnic, Yadrav helped in joining the hands in
developing each and every steps of this project and for valuable guidance and
constant encouragement during completion of project work. It was my privilege
and pleasure to work under his valuable guidance. I am indeed gratefully to him
for providing me helpful suggestions. Due to his constant encouragement and
inspiration I could complete my project work.
I am very thankful to Principal, Sharad Institute of Technology,
Polytechnic, Yadrav.

My grateful thanks to Mr. R. M. Patil Head of Computer Engineering


Department, for their valuable guidance, support and constant encouragement.

I express thanks to my family and friends for their support and


encouragement at every stage of successful completion of this project work.

My sincere thanks to all those who have directly or indirectly helped me


to carry out this work.

Name of the candidate Roll No

1) AISHWARYA MAHESH SHIVANAGI. 12438

2) SHWETA BALASO SANGLE. 12436

3) SANIYA IMTIYAJ SHIRGAVE. 12437


Micro Project Report

 Title : Reverse a String and a Number Using


Stack.

 Brief Description-
Reverse a string and a number using stack project should be able
to reverse a string and a number given by the user. The main aim of the
project was to reverse a given string and a number using stack.

 Introduction:

This project will give us the information about how to reverse a


string and number using stack. Stack is a abstract data type. Stack is
called as Last In First Out (LIFO) data structure. In stack, insertion and
deletion operations are performed only from a one end, called as top.
Reversing a number means getting the exact opposite number of given
number Ex.- 1234, Reverse is: 4321. And reversing a string means getting
exact opposite string Ex.- abc, Reverse is: cba.
push() function is used to push or insert an element at the top of the stack
container. The content of the new element is copied and initialized.
pop() is used to pop or remove an element from the top of the stack
container. The content from the top is removed and the size of the
container is reduced by 1.
 Aim of Project-

To reverse a string and number using stack.

 Course Outcomes Achieved-

 Implement basic operations on stack using array representation.

 Literature Review-

In order to understand the concepts associated with records


management and or computer based records management systems, it is
imperative to examine and analyze published material from experts
regarding the field.

The purpose of this review is to analyze and examine and obtain


experience as regards the creation and archival processing of electronic
records. The review is based on an exhaustive assessment of the literature
on computerized electronic management and electronic records, and
contains an overview of the main concepts.

 Actual Methodology Followed-

1. Formation of groups.
2. Selected topic for project.
3. Prepared proposal.
4. Collection of information.
5. Started programming.
6. After doing program prepared Project report.
 Actual Resources Used-

SR.NO. Name of Resources Specifications Quantity Remarks


/Material

1 Operating System Windows 10 3 Yes

2 CPU Intel (i) core i3 3 Yes

3 RAM 4GB 3 Yes

4 Software - 3 Yes

5 Browser - 3 Yes

Websites www.geeksforgeeks.org 1 Yes

7
Data Structures Using C 1
Reference Books Yes
Tech-Max

8 Other Resources Mouse, Keyboard Each 3 Yes


 Code of the Micro Projects-
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#define max 100
int stack[max],top=-1;
void pushstr(char);
int popstr();
void pushno(int);
int popno();
void main()
{
int ch, i;
char str[20];
clrscr();
while(1)
{
printf("\n 1. Reverse a string");
printf("\n 2. Reverse a number");
printf("\n 3.Quit");
printf("\n Enter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1: printf("\n Enter a string");
scanf("%s",&str);
for(i=0;i<strlen(str);i++)
{
pushstr(str[i]);
}
for(i=0;i<strlen(str);i++)
{
str[i]=popstr();
}
printf("\n Reversed string is: %s", str);
break;
case 2: printf("\n Enter a number:");
scanf("%s",&str);
for(i=0;i<strlen(str);i++)
{
pushno(str[i]);
}
for(i=0;i<strlen(str);i++)
{
str[i]=popno();
}
printf("\n Reversed no is %s", str);
break;
case 3: exit(0);
break;
default: printf("\n Invalid Input");
}
}
getch();
}
void pushstr(char item)
{
if(top==max)
{
printf("\n Stack is overflow");
}
else
{
top=top+1;
stack[top]=item;
}
}
int popstr()
{
char item;
if(top==-1)
{
printf("\n Stack is underflow");
}
else
{
item=stack[top];
top=top-1;
return item;
}
}

void pushno(int number)


{
if(top==max-1)
{
printf("\n Stack is overflow");
}
else
{
top++;
stack[top]=number;
}
}
int popno()
{
int number;
if(top==-1)
{
printf("\n Stack is underflow");
}
else
{
number=stack[top];
top=top-1;
}
return number;
}
 Explanation of the code:
 Header files:

1. stdio.h:- The ‘printf’ and ‘scanf’ functions are defined in this file.

2. conio.h:- The ‘clrscr()’ and ‘getch()’ functions are defined in this file.

3. string.h:- All the string functions are defined in this header file.

4. stdlib.h:- All the library functions are defined in this header file.

 max is used to store size of the stack.


 Stack is variable of int type of size max.
 top variable of int type is set to -1.
 pushstr(char) function is defined for pushing a given string into the stack.
 popstr() function is defined for popping out pushed string and get the reverse
of a string. It has return type int.
 pushno(int) function is used for pushing a given number into the stack.
 popno() function is used for popping out pushed number and get the reverse
of a number. It has return type int.
 while loop is used for printing the data repeatedaly.
 switch case is used for getting the choice from user.
There are 2 choices: a) Reverse a string.
b) Reverse a number.
 Outputs of the Micro Projects-
 Skill Developed/Learning out of this Project-
We got the concept of reversing a string and a number using stack.
We got the additional knowledge and skills from this project.
Through this project we are able to develop a program for reverse a string
a number using stack using ‘C’ language.
Skills and competencies are developed after the completion of the project.

 Applications of this Project-


This software is useful because it is friendly, simple, fast, and cost –
effective.
It is used to reverse a given string and a number.

Name & Sign of Guide:-

(Project Guide)

Mr. R. M. Patil.

You might also like