+ 1
Loop in c++ and python
python: import time a = 0 while a <= 100; print(a) a += 1 time.sleep(1) c++: #include <iostream> #include <unistd.h> using namespace std; int main() { int a; a = 1; while (a < 100){ cout << a; a++; usleep(1000000); } } why in c++ we must wait until a = 100. i want like python, so each after a + 1, it will print a. how to do that?
1 Answer
+ 2
Just make do. You can't do anything.
Python is more of a spoonfeeding language