From 503710ad8844fcf47665e0d75f85ec9d51c2e8bd Mon Sep 17 00:00:00 2001 From: augustin64 Date: Thu, 18 Jan 2024 12:00:34 +0100 Subject: [PATCH] Add newline on EOF --- example/fibonacci_imp.c | 2 +- example/fibonacci_rec.c | 2 +- example/primes.c | 2 +- example/stack_trace.c | 2 +- src/input.cpp | 4 ++++ 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/example/fibonacci_imp.c b/example/fibonacci_imp.c index 86257ca..1f6e1cc 100644 --- a/example/fibonacci_imp.c +++ b/example/fibonacci_imp.c @@ -14,4 +14,4 @@ else { }; result = prev1+prev2; } -result;; +result; \ No newline at end of file diff --git a/example/fibonacci_rec.c b/example/fibonacci_rec.c index fa4c525..314b831 100644 --- a/example/fibonacci_rec.c +++ b/example/fibonacci_rec.c @@ -5,4 +5,4 @@ int fibo(int n) { return fibo(n - 1) + fibo(n - 2); } } -fibo(15);; +fibo(15); \ No newline at end of file diff --git a/example/primes.c b/example/primes.c index 032578b..e19101b 100644 --- a/example/primes.c +++ b/example/primes.c @@ -18,4 +18,4 @@ int max_prime(int limit) { return prime; } -max_prime(250);; +max_prime(250); \ No newline at end of file diff --git a/example/stack_trace.c b/example/stack_trace.c index 4e946fc..b1800a6 100644 --- a/example/stack_trace.c +++ b/example/stack_trace.c @@ -10,4 +10,4 @@ int main(int x) { return function2(x, 2*x+3)*12; } -main(3);; +main(3); \ No newline at end of file diff --git a/src/input.cpp b/src/input.cpp index d58920a..37e623b 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -41,6 +41,10 @@ string get_line_with_hist(vector history, int line_num, bool &received_e if (ch == 4 || ch == EOF) { // 4 is End Of Transmission which can also be received received_eof = true; + + if (input.size() > 0) + cout << endl; + return input; }