+ 1
Can someone debugg my code because am being told its needed
You are making an app to control the entrance to a club. Only clients who are 16 and above are allowed to enter. Take the age of the client as input, then output " Welcome" incase it's greater or equal to 16 and "Not Allowed" if it's not I.e if the user enters 28 as their age, the output should be "welcome". Output should be with a capital starting letter.
5 Answers
+ 2
#include <iostream>
using namespace std;
int main() {
//your code goes here
int age=18;
cin>>age;
if (age>=16){
cout<<"Welcome";
}
else{
cout<<"Not allowed";
}
}
This is how it should look like, you can compare to the old one and see whats wrong
+ 1
#include <iostream>
using namespace std;
int main() {
//your code goes here
int age==18; // it's error statement. Just put int age ; as declaration. You can assign also when you need like int age = 18; // use = (assignment operator) ,
not the ==. (comparison operator)
cin>>age
if (age>=16); // don't put semicolon ; after if condition.
[ // use { } for block initialization. [ ] are used for indexing..
cout<<"Welcome";] // here also remove ]
else[ // here also remove [
cout<<"Not allowed";
] // remove these and put } } instead..
]
0
#include <iostream>
using namespace std;
int main() {
//your code goes here
int age==18;
cin>>age
if (age>=16);
[
cout<<"Welcome";]
else[
cout<<"Not allowed";
]
]
0
That's the code
0
Let me try