Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
else if(choice==2)//if you choose 2 DISPLAY
{
system("cls");
for(int y=0;myHigh>y;y++)//display all elements stored in the array
{
cout<<r[y]<<endl<<endl;
}
cout<<endl<<endl;
goto BEGIN;// go to the beginning
}
else if(choice==3)//if you choose 3 EXIT
{
return 0;
}
else //wrong choice
{
goto BEGIN;//go to the beginning
cout<<"\nWrong Choice\n\n";
}
system("pause");
}
using namespace std;
int r[6]={1,2,3,4,5,6}; //The array being stored
int CAP=6; //Capacity of the Array
int myHigh=6; //Highest Element in the Array
int choice;
int main()
{
BEGIN: //Designate the Beginning
cout<<"Stack with Capacity of 6\n\n";
cout<<"[1]TOP\n[2]DISPLAY\n[3]EXIT\n";
cout<<"Your Choice: ";cin>>choice;
if(choice==1) //if you choose 1 TOP
{
system("cls");
cout<<endl<<endl;
if(myHigh==0) //if highest element is 0
{
system("cls");
cout<<"Your Stack is Empty\n\n"<<endl; //Stack is empty
goto BEGIN; //goto to the beginning
}
else
{
cout<<"TOP is "<<r[myHigh-1];//array index begins with 0
cout<<endl<<endl;
goto BEGIN;// go to beginning
}