What's wrong here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong here?

#include <iostream> using namespace std; int age = 42; if (age == 18) { cout << "Young" << endl; } if (age == 42) { cout << "Adult" << endl; } if (age == 70) { cout << "Senior" << endl; } Error: ./Playground/file0.cpp:5:1: error: expected unqualified-id before 'if' | if (age == 18) { | ^~ Error: ./Playground/file0.cpp:5:1: error: expected unqualified-id before 'if' | if (age == 42) { | ^~ Error: ./Playground/file0.cpp:5:1: error: expected unqualified-id before 'if' | if (age == 70) { | ^~

19th Dec 2021, 11:51 AM
Iuda Amaterasu
Iuda Amaterasu - avatar
2 Answers
+ 3
Looks like you accidentally deleted the main method...
19th Dec 2021, 11:56 AM
Lisa
Lisa - avatar
- 1
Looks like you accidentally deleted the main method...
19th Dec 2021, 12:01 PM
Iuda Amaterasu
Iuda Amaterasu - avatar