-4

I am so confused what is causing this error code, can anyone point out what is wrong?

#include <iostream>

main()
{
    int x;

    std::cin >> x;

    std::cout << "Answer is " << x + x << '\n';

    return 0;
}
  • 3
    Please post your code/errors as text, not images. For people that can't see images for one reason or another your question is unanswerable. We also can't copy the text from images, which stops us from being able to debug your code, i.e., help you. – NathanOliver Oct 19 '21 at 12:33
  • 1
    You may want to read this: [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/q/285551/12149471) – Andreas Wenzel Oct 19 '21 at 12:35
  • 1
    All questions here should have all relevant information ***in the question itself as plain text***. Links can stop working at any time making questions meaningless. Code, data, or errors shown as images cannot be copy/pasted; or edited or compiled for further research and investigation. Can you [edit] this question, removing and replacing all links and images with all relevant information as plain text? All code must meet all requirements of a [mre]. You can find many other questions here that explain everything in plain text, please use them as an example for how your question should look. – Sam Varshavchik Oct 19 '21 at 12:36
  • 3
    [What is the proper declaration of main in C++?](https://stackoverflow.com/a/4207223) – 001 Oct 19 '21 at 12:41
  • 1
    You cannot use a forward slash as a substitute for a backward slash. – Eljay Oct 19 '21 at 12:43
  • It should be `'\n'`, `'/n'` is treated as two characters, it's interpreted as an `int`, unfortunately the compiler doesn't give warning/error for this. Fix that, then copy/paste the actual error message. – Barmak Shemirani Oct 19 '21 at 12:47
  • Please also post the text of the error message. – Andreas Wenzel Oct 19 '21 at 14:07

1 Answers1

2

You missed function type specifier. It should be like this

 int main()
{
//...
}
Jugennd
  • 66
  • 7