<![CDATA[Allat1place - Programs]]>Thu, 19 Nov 2015 20:01:46 -0800Weebly<![CDATA[Structure2]]>Sun, 07 Nov 2010 08:16:52 GMThttp://allat1place.weebly.com/programs/structure2
/* structure : is a user-defined data type, used to store dissimilar
  type of data




syntax:


struct <tag>
{
structure-member-1;
structure-member-2;
....
....
strycture-member-n;
};


*/


#include<stdio.h>
#include<conio.h>


struct student
{
int roll;
char name[50];
float fee;
};


void main()
{
struct student s1,s2;


clrscr();
printf("\nSTUDENT - 1\n");
printf("\nEnter roll: ");
scanf("%d",&s1.roll);


printf("\nEnter name: ");
 //fflush(stdin);
scanf("%s",s1.name);


printf("\nEnter fee: ");
scanf("%f",&s1.fee);




printf("\nSTUDENT - 2\n");
printf("\nEnter roll: ");
scanf("%d",&s2.roll);


printf("\nEnter name: ");
 //fflush(stdin);
scanf("%s",s2.name);


printf("\nEnter fee: ");
scanf("%f",&s2.fee);




printf("\nRoll No: %d, Name: %s, Fee: %.2f",s1.roll,s1.name,s1.fee);
printf("\nRoll No: %d, Name: %s, Fee: %.2f",s2.roll,s2.name,s2.fee);


getch();
}]]>
<![CDATA[Structure]]>Sun, 07 Nov 2010 08:14:46 GMThttp://allat1place.weebly.com/programs/structure
/* structure : is a user-defined data type, used to store dissimilar
  type of data




syntax:


struct <tag>
{
structure-member-1;
structure-member-2;
....
....
strycture-member-n;
};


*/


#include<stdio.h>
#include<conio.h>


struct student
{
int roll;
char name[50];
float fee;
};


void main()
{
clrscr();
printf("\n%d",sizeof(struct student));
getch();
}]]>
<![CDATA[Stack implementation using array]]>Sun, 07 Nov 2010 08:12:49 GMThttp://allat1place.weebly.com/programs/stack-implementation-using-array
/*
Stack implementation using array


array
structure
pointer
function


Lipchutz
Tanenbaum


Baluja
RB Patel


*/


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define SIZE 5


int stack[SIZE];
int top=-1;


void push(int item)
{
if(top==SIZE-1)
{
printf("\nStack Overflow\n");
return;
}
stack[++top]=item;
}
void pop()
{
if(top==-1)
{
printf("\nStack Underflow\n");
return;
}
printf("\nItem popped is => %d\n",stack[top--]);
}
void display()
{
int i;
for(i=top;i>=0;i--)
printf("\n%d",stack[i]);
}


void main()
{
int choice,num;
clrscr();
while(1)
{
printf("\n##### MAIN MENU #####");
printf("\n1. PUSH");
printf("\n2. POP");
printf("\n3. DISPLAY");
printf("\n0. QUIT");


printf("\n\nEnter your choice: ");
scanf("%d",&choice);


switch(choice)
{
case 1:
printf("\nEnter the number to be pushed: ");
scanf("%d",&num);
push(num);
break;
case 2:
pop();
break;
case 3:
printf("\n\n");
display();
printf("\n\n");
break;
case 0:
exit(0);
default:
printf("\nWrong Choice, Try Again");
}
}
}

]]>
<![CDATA[Different way to represent data]]>Sun, 07 Nov 2010 08:10:52 GMThttp://allat1place.weebly.com/programs/different-way-to-represent-data
/*
data structure : different way to represent data


types of data structure


1. Linear Data Structure : (sequence should be maintained)
array, stack, queue, linkedlist etc..
2. Non-Linear Data Structure : (sequence not maintained)
tree,graph




STACK : is a linear data structure where insertion & deletion is performed
from one end only called TOP of the STACK.




works in LIFO (Last In First Out ) manner


term used:
insert ->push
delete  ->pop


overflow -> stack is full
underflow -> stack is empty






*/


void push(int item)
{
if(top==SIZE-1)
{
printf("\nStack Overflow\n");
return;
}
stack[++top]=item;
}
void pop()
{
if(top==-1)
{
printf("\nStack Underflow\n");
return;
}
printf("\nItem popped is => %d",stack[top--]);
}

]]>
<![CDATA[First Post!]]>Sun, 07 Nov 2010 08:06:46 GMThttp://allat1place.weebly.com/programs/first-post