mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-04 06:07:20 +08:00 
			
		
		
		
	docs: add Japanese translate documents (#1812)
* docs: add Japanese documents (`ja/docs`) * docs: add Japanese documents (`ja/codes`) * docs: add Japanese documents * Remove pythontutor blocks in ja/ * Add an empty at the end of each markdown file. * Add the missing figures (use the English version temporarily). * Add index.md for Japanese version. * Add index.html for Japanese version. * Add missing index.assets * Fix backtracking_algorithm.md for Japanese version. * Add avatar_eltociear.jpg. Fix image links on the Japanese landing page. * Add the Japanese banner. --------- Co-authored-by: krahets <krahets@163.com>
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							2487a27036
						
					
				
				
					commit
					954c45864b
				
			
							
								
								
									
										41
									
								
								ja/codes/cpp/chapter_stack_and_queue/stack.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								ja/codes/cpp/chapter_stack_and_queue/stack.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,41 @@
 | 
			
		||||
/**
 | 
			
		||||
 * File: stack.cpp
 | 
			
		||||
 * Created Time: 2022-11-28
 | 
			
		||||
 * Author: qualifier1024 (2539244001@qq.com)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../utils/common.hpp"
 | 
			
		||||
 | 
			
		||||
/* ドライバーコード */
 | 
			
		||||
int main() {
 | 
			
		||||
    /* スタックを初期化 */
 | 
			
		||||
    stack<int> stack;
 | 
			
		||||
 | 
			
		||||
    /* 要素プッシュ */
 | 
			
		||||
    stack.push(1);
 | 
			
		||||
    stack.push(3);
 | 
			
		||||
    stack.push(2);
 | 
			
		||||
    stack.push(5);
 | 
			
		||||
    stack.push(4);
 | 
			
		||||
    cout << "Stack stack = ";
 | 
			
		||||
    printStack(stack);
 | 
			
		||||
 | 
			
		||||
    /* スタックトップ要素にアクセス */
 | 
			
		||||
    int top = stack.top();
 | 
			
		||||
    cout << "Top element of the stack top = " << top << endl;
 | 
			
		||||
 | 
			
		||||
    /* 要素ポップ */
 | 
			
		||||
    stack.pop(); // 戻り値なし
 | 
			
		||||
    cout << "Element popped from the stack = " << top << ", after popping";
 | 
			
		||||
    printStack(stack);
 | 
			
		||||
 | 
			
		||||
    /* スタックの長さを取得 */
 | 
			
		||||
    int size = stack.size();
 | 
			
		||||
    cout << "Length of the stack size = " << size << endl;
 | 
			
		||||
 | 
			
		||||
    /* 空かどうかを判定 */
 | 
			
		||||
    bool empty = stack.empty();
 | 
			
		||||
    cout << "Is the stack empty = " << empty << endl;
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user