main.cpp
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* main.cpp :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: gychoi <gychoi@student.42seoul.kr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2023/12/31 16:51:38 by gychoi #+# #+# */ 9 /* Updated: 2024/01/11 00:42:15 by gychoi ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include <iostream> 14 15 #include "RPN.hpp" 16 17 int main(int argc, char* argv[]) 18 { 19 if (argc != 2) 20 { 21 std::cout << "Usage: ./RPN <Expression>" << std::endl; 22 return 1; 23 } 24 else 25 { 26 // ready to execute 27 } 28 29 try 30 { 31 std::cout << RPN::execute(argv[1]) << std::endl; 32 } 33 catch (std::exception& e) 34 { 35 std::cout << e.what() << std::endl; 36 return 1; 37 } 38 return 0; 39 }