0
Correct and incorrect answer help with code .
Hello ! I'm begginer and I want to ask is there a code when I type certain numbers for example 0000 to continue using the program , but if I type 0001 or other numbers that is not 0000 to exit the program ? Sorry fot my English ..
3 Réponses
+ 8
Yes you can, you can create an array of characters or string and then compare it
std::string str;
do
{
cin >> str;
//Statements
} while (strcmp(str, "0000") == 0);
0
Here's what it looks like on Python
import sys
inp = int(input())
if inp is not 0000:
print("Only 0000 is allowed")
sys.exit()
else:
print("You wrote 0000")
0
Thanks !