This blog is made for the students of class IX,X,XI,XII learning computer science. This blog will provide beneficial resources to the students.
Tuesday, 24 July 2018
Welcome
Hello!!!
Welcome to my Blog.This blog will help you all remain updated with new ongoing activities in the class and CBSE updates beneficial for your exams. This blog is made for the students of class IX,X,XI,XII students learning computer science.
Monday, 16 July 2018
Class X: Important Question Set Chapter Wise - FIT
Hello Students
This question set will be beneficial for you from CBSE point of view.
This question set will be beneficial for you from CBSE point of view.
Hard Work is the key of success!!!!
Sunday, 15 July 2018
Friday, 6 July 2018
Wednesday, 4 July 2018
C++ Program for Stack implementation using Arrays
//Stack operations PUSH,POP using Array
#include<iostream.h>
#include<conio.h>
#define MAX 5
int STACK[MAX],TOP;
//stack initialization
void initStack(){
TOP=-1;
}
//check it is empty or not
int isEmpty(){
if(TOP==-1)
return 1;
else
return 0;
}
//check stack is full or not
int isFull(){
if(TOP==MAX-1)
return 1;
else
return 0;
}
void push(int num){
if(isFull()){
cout<<"STACK is FULL."<<endl;
return;
}
++TOP;
STACK[TOP]=num;
cout<<num<<" has been inserted."<<endl;
}
void display(){
int i;
if(isEmpty()){
cout<<"STACK is EMPTY."<<endl;
return;
}
for(i=TOP;i>=0;i--){
cout<<STACK[i]<<" ";
}
cout<<endl;
}
//pop - to remove item
void pop(){
int temp;
if(isEmpty()){
cout<<"STACK is EMPTY."<<endl;
return;
}
temp=STACK[TOP];
TOP--;
cout<<temp<<" has been deleted."<<endl;
}
int main(){
int num;
initStack();
char ch;
do{
int a;
cout<<"Chosse \n1.push\n"<<"2.pop\n"<<"3.display\n";
cout<<"Please enter your choice: ";
cin>>a;
switch(a)
{
case 1:
cout<<"Enter an Integer Number: ";
cin>>num;
push(num);
break;
case 2:
pop();
break;
case 3:
display();
break;
default :
cout<<"An Invalid Choice!!!\n";
}
cout<<"Do you want to continue ? ";
cin>>ch;
}while(ch=='Y'||ch=='y');
return 0;
}
#include<iostream.h>
#include<conio.h>
#define MAX 5
int STACK[MAX],TOP;
//stack initialization
void initStack(){
TOP=-1;
}
//check it is empty or not
int isEmpty(){
if(TOP==-1)
return 1;
else
return 0;
}
//check stack is full or not
int isFull(){
if(TOP==MAX-1)
return 1;
else
return 0;
}
void push(int num){
if(isFull()){
cout<<"STACK is FULL."<<endl;
return;
}
++TOP;
STACK[TOP]=num;
cout<<num<<" has been inserted."<<endl;
}
void display(){
int i;
if(isEmpty()){
cout<<"STACK is EMPTY."<<endl;
return;
}
for(i=TOP;i>=0;i--){
cout<<STACK[i]<<" ";
}
cout<<endl;
}
//pop - to remove item
void pop(){
int temp;
if(isEmpty()){
cout<<"STACK is EMPTY."<<endl;
return;
}
temp=STACK[TOP];
TOP--;
cout<<temp<<" has been deleted."<<endl;
}
int main(){
int num;
initStack();
char ch;
do{
int a;
cout<<"Chosse \n1.push\n"<<"2.pop\n"<<"3.display\n";
cout<<"Please enter your choice: ";
cin>>a;
switch(a)
{
case 1:
cout<<"Enter an Integer Number: ";
cin>>num;
push(num);
break;
case 2:
pop();
break;
case 3:
display();
break;
default :
cout<<"An Invalid Choice!!!\n";
}
cout<<"Do you want to continue ? ";
cin>>ch;
}while(ch=='Y'||ch=='y');
return 0;
}
Subscribe to:
Comments (Atom)
-
Hello You can download sample papers of FIT from the following CLICK HERE -- to download CBSE sample paper 2017-18 CLICK HER...
-
Hello!!! Welcome to my Blog.This blog will help you all remain updated with new ongoing activities in the class and CBSE updates benef...
-
Hello Students Download the ASSIGNMENT of chapter HTML and XML for practice
Welcome
Hello!!! Welcome to my Blog.This blog will help you all remain updated with new ongoing activities in the class and CBSE updates benef...