aboutsummaryrefslogtreecommitdiff
path: root/cpp00/ex01/main.cpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-09 12:35:58 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-09 12:35:58 +0100
commit0458a2f2fb93abcbf5f400e5eb1121a24e752ae1 (patch)
treeffe76794a258176d59738b841c19be3ea84bdcbb /cpp00/ex01/main.cpp
parentb799c007a1b6911fcbe5141429ea541e1277ebdd (diff)
downloadpiscine_cpp-0458a2f2fb93abcbf5f400e5eb1121a24e752ae1.tar.gz
piscine_cpp-0458a2f2fb93abcbf5f400e5eb1121a24e752ae1.tar.bz2
piscine_cpp-0458a2f2fb93abcbf5f400e5eb1121a24e752ae1.zip
Fixing cpp00/ex01
Diffstat (limited to 'cpp00/ex01/main.cpp')
-rw-r--r--cpp00/ex01/main.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/cpp00/ex01/main.cpp b/cpp00/ex01/main.cpp
index 8b04fe2..c415cbb 100644
--- a/cpp00/ex01/main.cpp
+++ b/cpp00/ex01/main.cpp
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/13 07:23:15 by charles #+# #+# */
-/* Updated: 2020/11/09 09:22:22 by cacharle ### ########.fr */
+/* Updated: 2020/11/09 12:17:23 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -22,7 +22,8 @@ int main()
while (true)
{
- std::cout << "> " << std::flush;
+ if (std::cin.good())
+ std::cout << "> " << std::flush;
if (!std::getline(std::cin, input))
break;
std::cout.flush();
@@ -43,7 +44,7 @@ int main()
if (tmp < 0 || size_t(tmp) >= phoneBook.getSize())
std::cout << "Error: Not valid index: " << tmp << std::endl;
else
- phoneBook.get(tmp).put();
+ phoneBook.get(size_t(tmp)).put();
std::cout << std::flush;
}
}