I am having some trouble with the browser-based compiler, codepad and every time I compile a long program, I always end up with an error and a message appears, saying : "SYS_fork". Is this normal, or do I need to download a real compiler that would actually run my code.
#include <iostream>
#include <string>
usingnamespace std;
int main() //the main and executable part of the program
{
int age;
string question;
question = "What is your current age?\n";
cout << question; //prints out the question
cin>>age; //user inputs their age
if(age < 1) {
cout << "you are less than a year old.\n";
}
if(age == 1) {
cout << "you are an infant.\n";
}
elseif(age > 1 && age <= 5) {
cout << "you are a toddler.\n";
}
elseif(age >= 6 && age < 13) {
cout << "you are just a kid.\n";
}
elseif(age > 12 && age < 20)
{
cout << "you are a teenager.\n";
}
elseif(age >= 20 && age < 50) {
cout << "you are a grown adult.\n";
}
else {
cout << "you are an old, elderly person\n";
}
system("pause"); //This is only required if the compiler is acting up
return 1; //checks for any errors
}
It is complaining about line 42 system("pause"); //This is only required if the compiler is acting up
Use of system() should be avoided. In this case the online compiler simply rejects it - this could be an attempt to hack the server or other security risk. Just remove that line.
As for downloading a proper compiler, yes I recommend that too,