diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-09 12:35:58 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-09 12:35:58 +0100 |
| commit | 0458a2f2fb93abcbf5f400e5eb1121a24e752ae1 (patch) | |
| tree | ffe76794a258176d59738b841c19be3ea84bdcbb /cpp00/ex01/utils.cpp | |
| parent | b799c007a1b6911fcbe5141429ea541e1277ebdd (diff) | |
| download | piscine_cpp-0458a2f2fb93abcbf5f400e5eb1121a24e752ae1.tar.gz piscine_cpp-0458a2f2fb93abcbf5f400e5eb1121a24e752ae1.tar.bz2 piscine_cpp-0458a2f2fb93abcbf5f400e5eb1121a24e752ae1.zip | |
Fixing cpp00/ex01
Diffstat (limited to 'cpp00/ex01/utils.cpp')
| -rw-r--r-- | cpp00/ex01/utils.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cpp00/ex01/utils.cpp b/cpp00/ex01/utils.cpp index 27c7daa..93b916d 100644 --- a/cpp00/ex01/utils.cpp +++ b/cpp00/ex01/utils.cpp @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 07:31:30 by charles #+# #+# */ -/* Updated: 2020/04/13 08:43:18 by charles ### ########.fr */ +/* Updated: 2020/11/09 12:10:25 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,9 +15,11 @@ int getInt() { std::string s; - int tmp; + int tmp; - std::cin >> s; + std::getline(std::cin, s); + if (s.empty()) + return (-1); for (size_t i = 0; i < s.length(); i++) if (!isdigit(s[i])) return (-1); |
