⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f0faf6c72519001e1cd0d3cf7376f2a4

📁 introduction in java threads class
💻
字号:
class CStiva extends CLista
{
	public CStiva()
	{
		super();
			
		System.out.println("\n\n\nSe apeleaza constructorutorul CDeriv_stiva pentru obiect la adresa:");
		System.out.println(this);	
		
	
		super.CLista();
	}
	
	public void push( int a )
	{
		inserare_sfarsit( a );
	}

	public boolean pop()
	{
		if (isEmpty()==true)
			System.out.println("Stiva este goala.");	
		else
		{
			System.out.println(peek());	
			return stergere_sfarsit();
		}
	}

	public boolean isEmpty()
	{
		if( Prim == null )
			return true;
		else
			return false; 
	}
	
	public int peek()
	{
		return Ultim.nVal;
	}

	public boolean afis()
	{
		return afisare();
	}
	
	
	
	public static void meniu()
	{	
		System.out.println("\n\n\n1.Push\n2.Pop\n3.IsEmpty\n4.Peek\n5.Afisare\n0.Iesire\n\n\nIntroduceti optiunea: ");
	}
		
	public static void main( String args[] )
	{
		int	i = 0;
	
		CDeriv_stiva stiva = new CDeriv_stiva();
		
		Citire cit = new Citire();
			
			
		meniu();
			
		i = cit.getInteger();		
		
		while( i != 0 )
			{
				switch ( i )
				{
					case 1:
					{	
						int a , b;
						String c;
						
						System.out.println("\n\nDati varsta: ");
						a = cit.getInteger();
						
						System.out.println("\n\nDati cheia: ");
						b = cit.getInteger();
						
						System.out.println("\n\nDati numele: ");
						c = cit.getLine();	
					
						
						stiva.push( a , b , c );
						
						System.out.println("\nElement adaugat\n");
					
								
						meniu();
					}break;
					
					case 2:
					{
						if( stiva.pop() == true )
				 	 
							System.out.println("\nElement sters");
					    else
							System.out.println("\nStiva este goala!!\n");
						
				
					    //system("cls");
					 
						meniu();
					
					}break;
			
	 				case 3:
	 				{
	 					if( stiva.isEmpty() == true )
	 						System.out.println("\nStiva este goala!\n");
	 					else
	 						System.out.println("\nStiva nu este goala!\n");
	 					
	 					meniu();
	 				}break;
	 				
	 				case 4:
	 				{
	 					stiva.peek();
	 					
	 					meniu();
	 				}break;
	 				
	 				case 5:
	 				{
	 					
	 					if( stiva.afis() == false )
							System.out.println("Stiva este goala!");
				     
					
					  //  system("cls");
					 
						meniu();
					
					}break;
					
			}	 
		i = cit.getInteger();
		
			}
		}	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -