From 0b6b7599bd4e8146121079f88982eba3545fce2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BD=AF=E5=AE=89=E7=A7=91=E6=8A=80=EF=BC=88SoftSec-Tech?= =?UTF-8?q?=EF=BC=89?= Date: Mon, 27 Oct 2025 12:22:40 +0800 Subject: [PATCH] Replace direct input with getString function calls Refactor input handling to use getString function for user input. --- test.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test.cpp b/test.cpp index f1266f1..2155171 100644 --- a/test.cpp +++ b/test.cpp @@ -2,12 +2,23 @@ #include #include "big_data_int.h" +string getString(){ + auto* str = new string(); + str->reserve(100); + std::cout << "请输入内容:"; + std::cin.getline(str->c_str(), 100); // 直接读取到缓冲区 + + std::cout << "输入内容:" << str->c_str() << std::endl; + + return str; +} + int main() { cout<<"please input two numbers:"<>s_a; - cin>>s_b; + s_a = getString(); + s_b = getString(); cout<<"Please input the operator(+,-,*,/,%):"<