0

Anyone knows why it keeps me saying that the code is wrong?

//its c++ #include <iostream> int age; cin >> age; if (age == 16) { cout << "u can drive a motorbike" << endl; } if (age == 18) { cout << "u can drive a car" << endl; }

11th May 2018, 8:24 PM
Víctor Pla Cid
Víctor Pla Cid - avatar
6 odpowiedzi
+ 5
u need to add main function and std library (using namespace std)
11th May 2018, 8:42 PM
Kawaii
Kawaii - avatar
+ 3
Ben Allen (Njinx) ik but in this code is ok to use it
12th May 2018, 12:49 AM
Kawaii
Kawaii - avatar
+ 3
using namespace std; is missing firstly and secondly its neccessary to close your code inside int main () {/*your codes here*/}
12th May 2018, 4:36 AM
Shahil Ahmed
Shahil Ahmed - avatar
+ 1
There’s no main function
11th May 2018, 8:26 PM
TurtleShell
TurtleShell - avatar
+ 1
Kawaii While you're correct I wouldn't recommend using namespace std. This can cause conflicts with different libraries. Just prepend std:: to the beginning on each stl function.
11th May 2018, 10:40 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar