சி++: திருத்தங்களுக்கு இடையிலான வேறுபாடு

உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
சி *திருத்தம்*
வரிசை 305:
சி ++ நன்கு வகையான நினைவாக ஒதுக்கீடு கொண்டு உள்ளது
நிலையான நினைவாக ஒதுக்கீடு:இந்த நிலையான நினைவாக ஒதுக்கீடு என்பது ஒரு நிலையான வேரியபுல்கு ஒரு பொருளை ஒதுக்கீடுசெய்வது ஆகும் இந்த ஒதுக்கீடு கம்பையில் டைம்இன் போது நடை பெரும் ஒரு செயல் ஆகும் ஒதுக்கப்பட்ட சேமிப்பு பகுதி ஒரு நிலையான இடமாகும் செமிகபடுபோது அதனுடன் செயல்படும் நிரல் அமைந்து இருக்கும் .இது போன்ற திறவுசொர்கள் ஸ்டாடிக் என்ற சொலுடன் இணைத்து டிச்ளைர் செய்யப்படும்.
மாறும் நினைவாக ஒதுக்கீடுஇதில் செவிப்பு நமது தேவைக்கு ஏற்ப மாற்றி அமைத்து கொள்ளும் அளவிற்கு உள்ளது .
<div style="float:left; width:50%;">
<syntaxhighlight lang="cpp">
# include <iostream.h>
# include <conio.h>
# include <process.h>
 
class stack
{
int arr[50];
int top;
public:
int get_top();
stack()
{
top=-1;
}
void push(int);
int pop();
void peep();
};
int display_menu();
int stack :: get_top()
{
return(top);
}
void stack :: push(int no)
{
arr[top+1]=no;
top=top+1;
}
 
int stack :: pop()
{
int no;
if(top<0)
{
return(NULL);
}
else
{
no=arr[top];
top=top-1;
return(no);
}
}
 
void stack :: peep()
{
if(top>=0)
{
for(int i=top;i>=0;i--)
{
cout<<"Stack ["<<i<<"] :"<<arr[i]<<endl;
}
}
 
 
 
 
 
 
 
else
{
cout<<"Empty Stack !!!"<<endl;
}
}
 
void main()
{
stack s1;
while(1)
{
switch(display_menu())
{
case 1: cout<<"Enter Number to push :";
int no;
cin>>no;
s1.push(no);
s1.peep();
getch();
break;
case 2:
no=s1.pop();
if(no!=NULL)
{
cout<<"Stack ["<<s1.get_top()+1<<"] :"<<no;
}
else
{
cout<<"Empty Stack !!!"<<endl;
}
getch();
break;
case 3: s1.peep();
getch();
break;
case 4: exit(1);
 
}
}
}
 
int display_menu()
{
clrscr();
int ch;
cout<<endl;
cout<<"\t\t\t| 1 | : PUSH"<<endl;
cout<<"\t\t\t| 2 | : POP"<<endl;
cout<<"\t\t\t| 3 | : PEEP"<<endl;
cout<<"\t\t\t| 4 | : Exit"<<endl;
cout<<"\t\t\tEnter Your Choice :";
cin>>ch;
return(ch);
}
</syntaxhighlight>
</div>
 
== இவற்றையும் பாக்க ==
"https://ta.wikipedia.org/wiki/சி%2B%2B" இலிருந்து மீள்விக்கப்பட்டது