You know Python, this is C++





Hello World

PythonC++
print("Hello World") #include <iostream> using namespace std; int main() { cout << "Hello World\n" ; }




For Loop

PythonC++
for i in range(10): print(i) for (int i=0 ; i<10 ; i++) { cout << i << endl ; }




While Loops

PythonC++
i = 0 while i < 10: print(i) i = i + 1 int i ; i = 0 ; while (i < 10) { cout << i << endl ; i = i + 1 ; }




Conditionals

PythonC++
myStr = input("Enter a number: ") i = int(myStr) if i < 0 : print("It's negative") elif i > 0 : print("It's positive") else : print("It's zero") int i ; cout << "Enter a number: " ; cin >> i ; if (i < 0) { cout << "It's negative" << endl ; } else if (i > 0) { cout << "It's positive" << endl ; } else { cout << "It's zero" << endl ; }




Arrays/Lists

PythonC++
A = range(10) for i in A: print(i) int A[10], i ; for (i=0; i<10; i++) { A[i] = i ; } for (i=0; i<10; i++) { cout << A[i] << endl ; }




C++ != OOP