0

I need help plz

The user should enter data in a linked list and he must enter a number to stop the loop I tried to make it 000 but it's read like 0 what should i do

14th Dec 2019, 11:38 PM
Yasmine
Yasmine - avatar
5 odpowiedzi
+ 2
The structure should be something like this: string number = get input(); if(number == “000”){ quit(); } else { int n = stoi(number); //Rest of your code }
15th Dec 2019, 12:43 AM
Jax
Jax - avatar
+ 2
You could ask for a string and it the string is “000” you stop
14th Dec 2019, 11:54 PM
Jax
Jax - avatar
+ 2
I don’t know C, but in my C++ class I would always take my numbers as strings and convert them to numbers using stoi (After I checked to ensure no characters were provided). If you want to get 000 rather than 0 I would try to do something like that
15th Dec 2019, 12:30 AM
Jax
Jax - avatar
+ 1
Ok thank you i will try it
15th Dec 2019, 12:40 AM
Yasmine
Yasmine - avatar
0
So i take as input a string and to store data I use the function atoi??
15th Dec 2019, 12:22 AM
Yasmine
Yasmine - avatar